Fixing npm path in Windows 8 and 10

前端 未结 18 1607
孤街浪徒
孤街浪徒 2020-11-22 15:30

Have done a lot of googling, tried reinstalling node.js using the official installer, but my npm pathing still doesn\'t work.

This doesn\'t work

npm          


        
相关标签:
18条回答
  • 2020-11-22 15:42

    When you're on Windows but running VS Code in Windows Subsystem for Linux like this

    linux@user: /home$ code .

    you actually want to install NodeJs on Linux with

    linux@user: /home$ sudo apt install nodejs

    Installing NodeJs on Windows, modifying PATH and restarting will get you no results.

    0 讨论(0)
  • 2020-11-22 15:43

    You can follow the following steps:

    • Search environment variables from start menu's search box.
    • Click it then go to Environment Variables
    • Click PATH
    • click Edit
    • Click New and try to copy and paste your path for 'bin' folder [find where you installed the node] for example according to my machine 'C:\Program Files\nodejs\node_modules\npm\bin'

    If you got any error. try the another step:

    • Click New, then browse for the 'bin' folder
    0 讨论(0)
  • 2020-11-22 15:46

    add Environment Path to

    C:\Program Files\nodejs\node.exe;C:\Users[your username]\AppData\Roaming\npm

    0 讨论(0)
  • 2020-11-22 15:48

    Edit the System environment variables, and enter following path:

    C:\Program Files\nodejs\node.exe;

    C:\Users\{yourName}\AppData\Roaming\npm

    0 讨论(0)
  • 2020-11-22 15:48

    Installed Node Version Manager (NVM) for Windows: https://github.com/coreybutler/nvm-windows

    I'm using Windows 10 - 64 bit so I run... Commands:

    • nvm arch 64 (to make default the 64 bit executable)
    • nvm list (to list all available node versions)
    • nvm install 8.0.0 (to download node version 8.0.0 - you can pick any)
    • nvm use 8.0.0 (to use that specific version)

    In my case I had to just switch to version 8.5.0 and then switch back again to 8.0.0 and it was fixed. Apparently NVM sets the PATH variables whenever you do that switch.

    0 讨论(0)
  • 2020-11-22 15:49

    steps 1 in the user variable and system variable

      C:\Program Files\nodejs
    

    then check both node -v and the npm -v then try to update the the npm i -g npm

    0 讨论(0)
提交回复
热议问题