PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Sunday, August 21, 2022

[FIXED] How add commands to cygwin - npm

 August 21, 2022     cygwin, environment-variables, path, windows     No comments   

Issue

I use cygwin on windows 8.1 to have an Unix shell. But I cannot run commands such as npm from it.

What should I do to do it? Add some kind of env var to cygwin? Why it doesn't use windows PATH?

Edit: Actually I think that I misunderstood the problem here. It looks like npm is found by cygwin but it cannot be used. For instance I can use git from cygwin without any trouble.

$ npm
/cygdrive/d/Logiciels installés/nodejs/npm: line 2: $'\r' : command not found
/cygdrive/d/Logiciels installés/nodejs/npm: line 4: $'\r' : command not found
/cygdrive/d/Logiciels installés/nodejs/npm: line 5: Syntax error around « $'in\r' »
'cygdrive/d/Logiciels installés/nodejs/npm: line 5: `case `uname` in

So, it looks actually more like a npm issue.


Solution

This seems to be a problem with the npm script as mentioned here, https://github.com/joyent/node/issues/5912

Assuming you have installed nodejs in the default location you can run the following dos2unix command and fix the error.

dos2unix c:/Program\ Files/nodejs/npm

This fixed my problems with the npm script.



Answered By - Tharaka
Answer Checked By - Marie Seifert (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing