Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't run npm or any Node Module on Cmder (Windows 7) #1047

Closed
brunogarciavaz opened this issue Jul 21, 2016 · 8 comments
Closed

Can't run npm or any Node Module on Cmder (Windows 7) #1047

brunogarciavaz opened this issue Jul 21, 2016 · 8 comments

Comments

@brunogarciavaz
Copy link

brunogarciavaz commented Jul 21, 2016

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.

What I've tried

  • I've tried to add "%APPDATA%\npm\node_modules" and "AppData\Roaming\npm" to both System and User environment variables
  • Restarting the computer
  • Running cmd as admin inside of Cmder
  • Add "%APPDATA%\npm\node_modules" and "AppData\Roaming\npm" to "Cmder's user-startup.cmd" path.

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)

@zhudock
Copy link

zhudock commented Jul 23, 2016

For me, npm runs, but I'm specifically unable to npm install gulp. Running from the standard Windows cmd works just fine.

@brunogarciavaz
Copy link
Author

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.

@bogacg
Copy link

bogacg commented Sep 14, 2017

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%\"

@daxgames
Copy link
Member

daxgames commented Sep 16, 2017

@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.

@bogacg
Copy link

bogacg commented Sep 16, 2017

@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

@daxgames
Copy link
Member

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"

@stevenaw
Copy link

stevenaw commented Apr 5, 2018

Thanks @daxgames that worked perfectly

@youinmelin
Copy link

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants