Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not install typings files for JavaScript language features. Please ensure that NPM is installed or configure 'typescript.npm' in your user settings (again) #36444

Closed
jasonpolites opened this issue Oct 17, 2017 · 10 comments
Assignees
Labels
windows VS Code on Windows issues

Comments

@jasonpolites
Copy link

As per issue #24961 I'm creating a new issue with the same symptoms.

Environment

  • Windows 10 Home
  • Windows Linux Subsystem (Ubuntu)
  • VSC 1.17.1 (64 bit)

I access Node and NPM via NVM, then via the Integrated Terminal in VSC:

$ nvm --version
0.33.2
$ node --version
v6.11.4
$ npm --version
5.5.1
$ which npm
/home/jason/.nvm/versions/node/v6.11.4/bin/npm

I've tried various flavors of "typescript.npm" including:

/home/jason/.nvm/versions/node/v6.11.4/bin/npm
/Users/Jason/AppData/Local/lxss/home/jason/.nvm/versions/node/v6.11.4/bin/npm
C:\\Users\\Jason\\AppData\\Local\\lxss\\home\\jason\\.nvm\\versions\\node\\v6.11.4\\bin\\npm

No dice

I'd really like to stay within the Linux system rather than straddling the both Windows PATH and the subsystem PATH

@vscodebot vscodebot bot added the debug Debug viewlet, configurations, breakpoints, adapter issues label Oct 17, 2017
@jasonpolites
Copy link
Author

Not sure if it's relevant, but attempting to execute the TypeScript compiler as a Task also fails. tsconfig.json (from docs):

{
    "compilerOptions": {
        "target": "es6",
        "module": "commonjs",
        "sourceMap": true
    }
}

Running this from Tasks=>Run Build Task... results in:

> Executing task: tsc -p "c:\Users\Jason\<PROJECT_PATH>\tsconfig.json" <

/bin/bash: tsc: command not found
The terminal process terminated with exit code: 127

Terminal will be reused by tasks, press any key to close it.

In regular (bash shell) in integrated terminal:

$tsc --version
Version 2.5.3

I feel like there's a step I've missed somewhere to tell VSC to use the Linux subsystem rather than Windows.

@mjbvz mjbvz assigned mjbvz and unassigned isidorn Oct 17, 2017
@mjbvz mjbvz added the windows VS Code on Windows issues label Oct 17, 2017
@mjbvz
Copy link
Collaborator

mjbvz commented Oct 18, 2017

@dbaeumer should know more about the task issue.

For the npm problem, I'm not sure if we properly support running npm inside of wsl. @andy-ms shuld be able to clarify that. To help investigate, can you you try:

  1. Set "typescript.tsserver.log": "normal" in vscode
  2. Restart vscode and reproduce the issue
  3. Run the Open TS server log command in vscode
  4. Share the ti-xxx.log file in the opened folder.

This log file may help us understand what is going wrong

@jasonpolites
Copy link
Author

OK.. this looks relevant:

Global cache location 'C:/Users/Jason/AppData/Local/Microsoft/TypeScript/2.5', safe file path 'c:/program files/microsoft vs code/resources/app/extensions/node_modules/typescript/lib/typingsafelist.json'
Processing cache location 'C:/Users/Jason/AppData/Local/Microsoft/TypeScript/2.5'
Trying to find 'C:/Users/Jason/AppData/Local/Microsoft/TypeScript/2.5/package.json'...
Loaded content of 'C:/Users/Jason/AppData/Local/Microsoft/TypeScript/2.5/package.json': {}
Finished processing cache location 'C:/Users/Jason/AppData/Local/Microsoft/TypeScript/2.5'
Process id: 13464
NPM location: "/Users/Jason/AppData/Local/lxss/home/jason/.nvm/versions/node/v6.11.4/bin/npm" (explicit '--npmLocation'  provided)
Npm config file: C:/Users/Jason/AppData/Local/Microsoft/TypeScript/2.5/package.json
Updating types-registry npm package...
Error updating types-registry package: Command failed: "/Users/Jason/AppData/Local/lxss/home/jason/.nvm/versions/node/v6.11.4/bin/npm" install --ignore-scripts types-registry
Types registry file 'C:/Users/Jason/AppData/Local/Microsoft/TypeScript/2.5/node_modules/types-registry/index.json' does not exist

@jasonpolites
Copy link
Author

Hmm.. C:/Users/Jason/AppData/Local/Microsoft/TypeScript/2.5 is empty save for a package.json file, which contains an empty object ({})

Presumably the npm install that's setup tsc in the wsl shell is not the one being used by vsc.

@isidorn isidorn removed the debug Debug viewlet, configurations, breakpoints, adapter issues label Oct 18, 2017
@dbaeumer
Copy link
Member

This is a know issue in when trying to run task in WSL. The problem is that we currently assume that if the OS is Windows, paths are Windows paths. This is not true when tasks are executed in WSL or in git bash. Besides the / \ issue in WSL the path must be rewritten to /mnt/c/... to make it correct for WSL.

I can't comment on the typings issue but I think that the tsserver installs them on the Windows machine and not inside the WSL.

@mjbvz
Copy link
Collaborator

mjbvz commented Oct 19, 2017

Thank @dbaeumer!

Yes for the typings they would be installed on the windows machine. @jasonpolites have you tried installing npm on windows and just pointing typescript.npm to that one. The version of npm used for installing typings does not need to match the version of npm you are using in your project

@jasonpolites
Copy link
Author

@dbaeumer Yeah fair enough. I thought with WSL I could see myself going back to Windows for dev work, but still being tethered to the Windows environment is a little awkward (for me). I predict various compatibility issues as NPM (etc) versions differ between Win and WSL and keeping them in sync is a bit of a pain.

FWIW in Windows it would be amazing if VSC just had a use.wsl:true setting which magically adapted any path dependencies to use the WSL path and any binaries would execute in WSL

@dbaeumer
Copy link
Member

@jasonpolites we are currently collecting WSL issues (we have a label for it) to decide what the best solution for the problem will be.

@jasonpolites
Copy link
Author

ack. Feel free to close this if it keeps things clean. I'll assume my issue gets dragged into a broader set of wsl issues. Thanks for taking the time

@mjbvz
Copy link
Collaborator

mjbvz commented Oct 19, 2017

Ok, I'm going to close this as a duplicate of #20220 then

For now, you'll still need to install npm in your windows environment to get automatic typings acquisition. Again though, you still should be able to still use your wsl npm for actually managing the project

@mjbvz mjbvz closed this as completed Oct 19, 2017
@vscodebot vscodebot bot locked and limited conversation to collaborators Dec 3, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
windows VS Code on Windows issues
Projects
None yet
Development

No branches or pull requests

4 participants