TypeScript Version: 2.3.1-insiders0416
Steps to reproduce
On a machine that only has node installed using nvm and not globally (i.e. not in /usr/local/bin), trigger ATA through VSCode by adding an new package import to a javascript file
bug
ATA fails in this case and says that npm in not installed.
Sending response: {"kind":"event::beginInstallTypes","eventId":1,"typingsInstallerVersion":"2.3.1-insiders.20170416","projectName":"/Users/matb/projects/sand/jsconfig.json"}
Response has been sent.
#1 with arguments'["@types/[email protected]"]'.
npm install #1 took: 7 ms
stdout:
stderr: /bin/sh: npm: command not found
install request failed, marking packages as missing to prevent repeated requests: ["ace"]
Sending response: {"kind":"event::endInstallTypes","eventId":1,"projectName":"/Users/matb/projects/sand/jsconfig.json","packagesToInstall":["@types/[email protected]"],"installSuccess":false,"typingsInstallerVersion":"2.3.1-insiders.20170416"}
Response has been sent.
In this case, npm can be run from the user's command prompt just fine. It is linked to the nvm location for example: /Users/matb/.nvm/versions/node/v7.6.0/bin/npm
Note that this seems to work for me when starting VSCode in an environment that has npm in the PATH, such as: "/Users/matb/.nvm/versions/node/v7.6.0/bin:..."
Removing high pri label since there is a potential workaround
@andy-ms The installer uses child_process.exec which starts a shell, that then interprets the command and finally starts npm. Both starting the shell and interpreting the command could go wrong I think, depending on the user's shell and the shell's configuration. It might be more robust to just use child_process.spawn which avoids the shell entirely.
Sorry, what's the workaround? I have tried adding the explicit path to NPM (via NVM) to both my .zshrc and (as suggested on another thread) .bashrc. Neither works, opening from Spotlight nor Terminal/CLI. Still get the Could not install typings files for JavaScript language features. Please ensure that NPM is installed and is in your PATH error on start. This only started after the most recent update to Code (1.12.1).
@ambroselittle I don't think we have a workaround yet if it doesn't work when launching code from the terminal.
The proposal we have here as a workaround is to provide a way to explicitly set the npm location for ATA to use it.
my workaround:
OS: macOS Sierra 10.12.3
Most helpful comment
Sorry, what's the workaround? I have tried adding the explicit path to NPM (via NVM) to both my .zshrc and (as suggested on another thread) .bashrc. Neither works, opening from Spotlight nor Terminal/CLI. Still get the
Could not install typings files for JavaScript language features. Please ensure that NPM is installed and is in your PATHerror on start. This only started after the most recent update to Code (1.12.1).