Installing Node.js (and npm) on Windows 10

后端 未结 8 897
名媛妹妹
名媛妹妹 2020-11-28 04:48

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

The error was as follows:

C:\\Users\\Stephan>npm
Error: E

8条回答
  •  天命终不由人
    2020-11-28 05:13

    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\nodejs
    • 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}\AppData\Roaming\npm;C:\Program Files\nodejs

    If the PATH variable already contains C:\Users\{YOUR USERNAME HERE}\AppData\Roaming\npm, append the following right after: ;C:\Program Files\nodejs

    If the PATH variable contains information, but nothing regarding npm, append this to the end of the PATH: ;C:\Users\{YOUR USERNAME HERE}\AppData\Roaming\npm;C:\Program Files\nodejs

    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.

提交回复
热议问题