NodeJS:无法运行包(windows)

时间:2015-03-20 13:24:07

标签: windows node.js npm

我的电脑运行Windows 7 x64,我最近更新了NodeJS,因为我无法运行任何软件包,所以每次出现以下错误(例如Gulp):

'Gulp' is not recognized as an internal or external command, operable program or batch file.

我进行如下: 我第一次安装了NodeJS(node-v0.12.0-x64.msi)而没有卸载旧版本,第二次卸载NodeJS。 我重启了我的电脑。

npm init
npm install gulp --save-dev
gulp

然后我得到上面的错误...... :( 我的用户环境变量: NODE_PATH

%AppData%\npm\node_modules

PATH

C:\Program Files\nodejs;C:\Users\{mon_user}\AppData\Roaming\npm

系统环境变量: 路径

C:\Ruby200-x64\bin;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\OpenCL SDK\3.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\3.0\bin\x64;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\SWTOOLS\ReadyApps;C:\Program Files (x86)\Common Files\Lenovo;C:\Program Files\nodejs;C:\Program Files (x86)\Git\cmd

echo%PATH%命令返回:

C:\Users\{mon_user}\Downloads\cmder\bin;C:\Users\{mon_user}\Downloads\cmder\vendor\msysgit\bin;C:\Users\{mon_user}\Downloads\cmder\vendor\msysgit\mingw\bin;C:\Users\{mon_user}\Downloads\cmder\vendor\msysgit\cmd;C:\Users\{mon_user}\Downloads\cmder\vendor\msysgit\share\vim\vim74;C:\Users\{mon_user}\Downloads\cmder;C:\Users\{mon_user}\Downloads\cmder\vendor\conemu-maximus5\ConEmu;C:\Users\{mon_user}\Downloads\cmder\vendor\conemu-maximus5;C:\Ruby200-x64\bin;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\OpenCL SDK\3.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\3.0\bin\x64;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\SWTOOLS\ReadyApps;C:\Program Files (x86)\Common Files\Lenovo;C:\Program Files\nodejs;C:\Program Files (x86)\Git\cmd;C:\Users\{mon_user}\AppData\Roaming\npm

1 个答案:

答案 0 :(得分:1)

如果要从命令行运行gulp,则需要添加-g以全局安装。

npm install -g --save-dev gulp
gulp

如果您不想全局安装它,可以检查此stackoverflow线程:How to use package installed locally in node_modules?