如何将命令添加到 cygwin - npm [英] How add commands to cygwin - npm

查看:21
本文介绍了如何将命令添加到 cygwin - npm的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Windows 8.1 上使用 cygwin 来拥有一个 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.

我该怎么做?向 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?

其实我认为我误解了这里的问题.看起来 cygwin 找到了 npm,但无法使用.例如,我可以毫无困难地使用来自 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: $'
' : command not found
/cygdrive/d/Logiciels installés/nodejs/npm: line 4: $'
' : command not found
/cygdrive/d/Logiciels installés/nodejs/npm: line 5: Syntax error around « $'in
' »
'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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆