Node.js doesn’t recognize system path?

I’ve been working with node.js
, v0.6.3, locally installed on Windows Vista
at C:Program FilesNodejs
. I recently upgraded to (by running the installer for) v0.6.6 . It seemed like it worked for a while, but now if I try to run
‘node’` from any directory I get a

‘node’ is not recognized as an internal or external command

message, though running ‘node’ from C:Program FilesNodejs
does
work.

I tried rebooting, removing node, reinstalling, reinstalling 0.6.3 – nothing seems to work. I just don’t get why ‘node’ fails to recognize system path, though node works from its base dir?

Problem courtesy of: sellarafaeli

Solution

Node is missing from the SYSTEM PATH, try this in your command line

SET PATH=C:Program FilesNodejs;%PATH%

and then try running node

To set this system wide you need to set in the system settings – cf – http://banagale.com/changing-your-system-path-in-windows-vista.htm

To be very clean, create a new system variable NODEJS

NODEJS="C:Program FilesNodejs"

Then edit the PATH
in system variables and add %NODEJS%

PATH=%NODEJS%;...

Solution courtesy of: First Zero

Discussion

Everytime I install node.js
it needs a reboot and then the path is recognized.

Discussion courtesy of: RandallTo

Nodejs’s installation adds nodejs to the path in the environment properties incorrectly.

By default it adds the following to the path:

C:Program Filesnodejs

The ending
is unnecessary. Remove the
and everything will be beautiful again.

Discussion courtesy of: Varun Achar

Try adding C:Program FilesNodejs
to your PATH
environment variable. The PATH
environment variable allows run executables or access files within the folders specified (separated by semicolons).

On the command prompt, the command would be set PATH=%PATH%;C:Program FilesNodejs
.

Discussion courtesy of: Gio Borje

I set the NODEJS variable in the system control panel but the only thing that worked to set the path was to do it from command line as administrator.

SET PATH=%NODEJS%;%PATH%

Another trick is that once you set the path you must close the console and open a new one for the new path to be taken into account.

However for the regular user to be able to use node I had to run set path again not as admin and restart the computer

Discussion courtesy of: pasx

Make sure nodejs in the PATH is in front of anything that uses node.

Discussion courtesy of: Sandersjr2

Watch out for other paths ending in too. I had this:

...bin;C:Program FilesMicrosoftWeb Platform Installer;C:Program Filesnodejs

and changed it to this:

bin;C:Program FilesMicrosoftWeb Platform Installer;C:Program Filesnodejs

removing the final , but it still didn’t work. The previous path, for the Web Platform Installer, had a trailing too. Removing that fixed the problem.

Discussion courtesy of: user1207577

Go to the folder in which you have Node and NPM (such as C:Program Files (x86)nodejs
) and type the following:

> set path=%PATH%;%CD%
> setx path "%PATH%"

From http://www.hacksparrow.com/install-node-js-and-npm-on-windows.html

Discussion courtesy of: alessioalex

This recipe can be found in it’s original form on Stack Over Flow
.

Node.js Recipes责编内容来自:Node.js Recipes (源链) | 更多关于

阅读提示:酷辣虫无法对本内容的真实性提供任何保证,请自行验证并承担相关的风险与后果!
本站遵循[CC BY-NC-SA 4.0]。如您有版权、意见投诉等问题,请通过eMail联系我们处理。
酷辣虫 » 前端开发 » Node.js doesn’t recognize system path?

喜欢 (0)or分享给?

专业 x 专注 x 聚合 x 分享 CC BY-NC-SA 4.0

使用声明 | 英豪名录