如何添加命令到cygwin - npm [英] How add commands to cygwin - npm
问题描述
我使用cygwin在windows 8.1上有一个Unix shell。但我不能从它运行命令,如npm。
I use cygwin on windows 8.1 to have an Unix shell. But I cannot run commands such as npm from it.
我该怎么办呢?添加一些env var到cygwin?为什么它不使用Windows PATH?
What should I do to do it? Add some kind of env var to cygwin? Why it doesn't use windows PATH?
编辑:
其实我认为我误解了这里的问题。看起来npm是由cygwin找到,但它不能使用。例如,我可以使用来自cygwin的git没有任何麻烦。
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
所以,它看起来更像一个npm问题。
So, it looks actually more like a npm issue.
推荐答案
这似乎是这里提到的npm脚本的一个问题, https://github.com/joyent/node/issues/5912
This seems to be a problem with the npm script as mentioned here, https://github.com/joyent/node/issues/5912
假设您已将nodejs安装在默认位置,您可以运行以下dos2unix命令并修复错误。
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
dos2unix c:/Program\ Files/nodejs/npm
这解决了我使用npm脚本的问题。
This fixed my problems with the npm script.
这篇关于如何添加命令到cygwin - npm的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!