Fixing npm path in Windows 8 and 10

前端 未结 18 1606
孤街浪徒
孤街浪徒 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:51

    If after installing your npm successfully, and you want to install VueJS then this is what you should do

    after running the following command (as Admin)

    npm install --global vue-cli

    It will place the vue.cmd in the following directory C:\Users\YourUserName\AppData\Roaming\npm

    you will see this in your directory.

    Now to use vue as a command in cmd. Open the cmd as admin and run the following command.

    setx /M path "%path%;%appdata%\npm"

    Now restart the cmd and run the vue again. It should work just fine, and then you can begin to develop with VueJS.

    I hope this helps.

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

    change the path for nodejs in environment varibale.

    setting environment variable

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

    I've had this issue in 2 computers in my house using Windows 10 each. The problem began when i had to change few Environmental variables for projects that I've been working on Visual studio 2017 etc. After few months coming back to using node js and npm I had this issue again and non of the solutions above helped. I saw Sean's comment on Yar's solution and i mixed both solutions: 1) at the environmental variables window i had one extra variable that held this value: %APPDATA%\npm. I deleted it and the problem dissapeared!

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

    Try this one dude if you're using windows:

    1.) Search environment variables at your start menu's search box.
    2.) Click it then go to Environment Variables...
    3.) Click PATH, click Edit
    4.) Click New and try to copy and paste this: C:\Program Files\nodejs\node_modules\npm\bin

    If you got an error. Do the number 4.) Click New, then browse the bin folder

    • You may also Visit this link for more info.
    0 讨论(0)
  • 2020-11-22 16:01

    Go to control panel -> System -> Advanced System Settings then environment variables.

    From here find the path variable, Go to the end of the line and paste "C:\Program Files\nodejs\node_modules\npm\bin" (change the path to the directory to where ever you installed it e.g. if you specifically installed it anywhere change it)

    0 讨论(0)
  • 2020-11-22 16:01

    This worked for me: 1. npm root -g (to see the current npm is installed) 2. npm config set prefix (to change the path)

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