I simply can't run "npm" or, for instance, "gulp" on my cmder. But I can run it if I manually open the cmd
位 gulp
'gulp' is not recognized as an internal or external command,
operable program or batch file.
If I run npm manually from the Nodejs directory, it works. So I added an alias with alias npm=C:\Progra~1\nodejs\npm.cmd $* and now npm works, but I guess that's not the best solution, since I can't run Node modules.
I can run Ruby's gem or Python inside of cmder just fine, but Node just won't work specifically inside of Cmder (but will work on window's native cmd.exe)
For me, npm runs, but I'm specifically unable to npm install gulp. Running from the standard Windows cmd works just fine.
Downloading the latest version of Cmder from the Github repo fixed it (both npm and gulp, I'm not sure if the last version fixed it or if it was because I reinstalled it)
I also updated npm and reinstalled nodejs.
Editing \cmder\vendor\init.bat and adding %APPDATA%\npm to PATH fixed things to me.
:: Enhance Path
set "PATH=%CMDER_ROOT%\bin;%PATH%;%APPDATA%\npm;%CMDER_ROOT%\"
@bogacg You should not edit \cmder\vendor\init.bat because your changes will be overwritten on update. instead you shoul add a path.cmd/path.sh/pasth.ps1 file to cmder\config\profile.d\ that enhances the path with what you need. These changes will not be overwritten on update.
@daxgames Thanks for the heads up. I was aware that it wont get updated but didn't know better way.
config\user-profile.cmd (and .sh and .ps1) is an example for that I guess. I'll copy that to cmder\config\profile.d\ and edit.
Quick question:
Does set PATH (in my path.cmd under config\profile.d\) overwrites whole line what is in vendor\init.bat or just adds what is not there. I guess it overwrites therefor I'm adding whole thing in cmder\config\profile.d\path.cmd
Just leave those files where they are and edit them. They also get run. I like to use profile.d others dont
In userprofile.cmd: set path=%path%;c:\my_dir
In userprofile.sh set $PATH=$PATH:c:\my_dir
In userprofile.ps1: $env:path="$env:path;c:\my_dir"
Thanks @daxgames that worked perfectly
Just leave those files where they are and edit them. They also get run. I like to use profile.d others dont
In userprofile.cmd: set path=%path%;c:\my_dir
In userprofile.sh set $PATH=$PATH:c:\my_dir
In userprofile.ps1: $env:path="$env:path;c:\my_dir"
Thank you very much! You are totally right! I just add this 'path=%path%;D:\testing_tools\dev\nodejs' in the file 'userprofile.cmd'. Then I can use node in the cmder. Cool!
Most helpful comment
Just leave those files where they are and edit them. They also get run. I like to use profile.d others dont
In userprofile.cmd: set path=%path%;c:\my_dir
In userprofile.sh set $PATH=$PATH:c:\my_dir
In userprofile.ps1: $env:path="$env:path;c:\my_dir"