> is it possible to interact with Windows level installed applications using WSL2's terminal?
Yes, you can run notepad.exe from WSL and it will open Notepad in Windows.
More documentation: https://docs.microsoft.com/en-us/windows/wsl/interop#run-windows-tools-from-linux
Solving the NPM issue
If I try running npm -v in WSL, I get an error about it not being able to find a file:
PS C:\Users\harvey> bash
harvey@harvey-w10x64-defiance:/mnt/c/Users/harvey$ npm -v
internal/modules/cjs/loader.js:968
throw err;
^
Error: Cannot find module 'C:\mnt\c\Program Files\nodejs\node_modules\npm\bin\npm-cli.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:965:15)
at Function.Module._load (internal/modules/cjs/loader.js:841:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
The path to the file is mostly correct but it has appended C:\mnt to it.
I managed to get around this by running npm by giving Node the path to the npm-cli.js file.
You can run:
node.exe \c\Program Files\nodejs\node_modules\npm\bin\npm-cli.js -v
But that runs into the same error.
I then tried this:
PS C:\Users\harvey> bash
harvey@harvey-w10x64-defiance:/mnt/c/Users/harvey$ cd "/mnt/c/Program Files/nodejs/node_modules/npm/bin"
harvey@harvey-w10x64-defiance:/mnt/c/Program Files/nodejs/node_modules/npm/bin$ ../../../node.exe npm-cli.js -v
6.14.6
From here I was finally able to get some output from the NPM CLI.
From here I can install the package but it will likely be installed in the wrong location.
I couldn't seem to get npm working from anywhere in the filesystem. This may be a limitation with NPM. Perhaps if you try messing with your path env vars, you can get it to work?