Node.JS - How to execute a Node command from any path?

I installed the latest node.js from here . I see that% Path% variables have been set for node.js. But, when I run node from C: \, I get a "Node unrecognized class". But the node command works fine with "path C: \ Program Files (x86) \ nodejs". Can I run node commands from C: \ or Say from another path if I set Env variables correctly? Please help. I am running Win7 X64.

Thanks Faraaz

+4
source share
5 answers

What happens if you run node --version ? I have never tried node.js from windows, but if this does not work, something is wrong in your paths.

What do you get when running echo %PATH% ?

+5
source

I had the same problem, but in my PATH variable I had: C:\Program Files\nodejs\ . After changing it to C:\Program Files\nodejs I could access it from anywhere.

+10
source

You should check if the path C:\Program Files (x86)\nodejs exists in %PATH . If not, add it through the system properties (constant change). In any case, restart the command line, it will reload the %PATH variable. If you're lucky, it should work now :)

+2
source

This is most likely due to the lack of a Node path in your PATH environment variable.

I see two ways to solve this problem.

  • Just add the Node path to the end of the PATH.
  • Reinstall Node as Administrator

run 7-zip (or some file manager) with administrator privileges → go to node -installer.msi → open it, install Node → enjoy

+2
source

My Sublime worked with Nodejs in order. I could press Alt-R and see the result from Node to Sublime. Then at some point I updated Sublime. I now have version 2.02 build 2221 and at some point I tried Alt-R and received this notorious message

'node' is not recognized as an internal or external command

But it worked, and what has changed?

The steps I took to fix this were to install git bash and then

 $ git clone https://github.com/tanepiper/SublimeText-Nodejs.git $ cd SublimeText-Nodejs/ $ git checkout 095ba03344 

In Sublime, I clicked Settings> Browse Packages. This opened Windows Explorer with the folder:

 C:\Users\me\AppData\Roaming\Sublime Text 2\Packages 

I replaced the contents of the Nodejs folder with the git version. Re-launched Sublime, and then Alt-R reappeared in life.

Other things that turned out to be irrelevant were changes to the Nodejs.sublime parameters file and interference with system environment variables. The only thing that worked was 095ba03344 , as described here https://github.com/tanepiper/SublimeText-Nodejs/pull/39

+1
source

Source: https://habr.com/ru/post/1383178/


All Articles