Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
263 views
in Technique[技术] by (71.8m points)

Installing Node.js (and npm) on Windows 10

I had some issues trying to install Node on Windows 10 and found the solution.

The error was as follows:

C:UsersStephan>npm
Error: ENOENT, stat 'C:UsersStephanAppDataRoaming pm'

The solution is below.

Question&Answers:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Edit: It seems like new installers do not have this problem anymore, see this answer by Parag Meshram as my answer is likely obsolete now.

Original answer:

Follow these steps, closely:

  • http://nodejs.org/download/ download the 64 bits version, 32 is for hipsters
  • Install it anywhere you want, by default: C:Program Files odejs
  • Control Panel -> System -> Advanced system settings -> Environment Variables
  • Select PATH and choose to edit it.

If the PATH variable is empty, change it to this: C:Users{YOUR USERNAME HERE}AppDataRoaming pm;C:Program Files odejs

If the PATH variable already contains C:Users{YOUR USERNAME HERE}AppDataRoaming pm, append the following right after: ;C:Program Files odejs

If the PATH variable contains information, but nothing regarding npm, append this to the end of the PATH: ;C:Users{YOUR USERNAME HERE}AppDataRoaming pm;C:Program Files odejs

Now that the PATH variable is set correctly, you will still encounter errors. Manually go into the AppData directory and you will find that there is no npm directory inside Roaming. Manually create this directory.

Re-start the command prompt and npm will now work.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...