简体   繁体   English

-bash: <npm package> 找不到相关命令

[英]-bash: <npm package> command not found

I have been working on a site for several weeks, and just recently I ran into a problem. 我在一个网站上工作了几个星期,而最近我遇到了一个问题。 Now whenever I try to run gulp or JSPM, I get the following errors: 现在,每当我尝试运行gulp或JSPM时,都会出现以下错误:

-bash: gulp: command not found -bash:gulp:找不到命令

-bash: jspm: command not found -bash:jspm:找不到命令

Uninstalling and reinstalling Node and NPM hasn't seemed to have helped. 卸载和重新安装Node和NPM似乎没有帮助。 I've also installed both Gulp and JSPM globally just now, and still have the same issue. 我现在也已经在全球范围内安装了Gulp和JSPM,但仍然存在相同的问题。

I'm working on a Mac while a colleague of mine is using Windows. 我的同事正在使用Windows时,我正在Mac上工作。 Using the same codebase, everything seems to be working for him fine in Windows. 使用相同的代码库,一切似乎在Windows中都可以正常工作。

In case it helps, here's what my $PATH looks like: /usr/local/share/npm/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/git/bin: 如果有帮助,这是我的$ PATH样子: /usr/local/share/npm/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/git/bin:

I'm happy to provide more details, although I'm not sure what other information would help. 我很乐意提供更多详细信息,尽管我不确定还有哪些其他信息会有所帮助。

Adding this here for any googlers: for a Windows 10 user you need to add %USERPROFILE%\\AppData\\Roaming\\npm to your Path variable 在此处为所有Google员工添加此代码:对于Windows 10用户,您需要将%USERPROFILE%\\AppData\\Roaming\\npm到您的Path变量中

  • Right click on start, choose System 右键单击开始,选择系统
  • Click Advanced System Settings on the left 点击左侧的高级系统设置
  • Under the Advanced tab select Environment Variables 在高级选项卡下,选择环境变量
  • Find Path in the System Variables section, select it and then click Edit 在“系统变量”部分中找到“路径”,选择它,然后单击“编辑”。
  • Click New and type in %USERPROFILE%\\AppData\\Roaming\\npm 单击“新建”,然后键入%USERPROFILE%\\AppData\\Roaming\\npm
  • Restart your terminal, it should now recognize any modules you have installed globally 重新启动您的终端,它现在应该可以识别您已全局安装的所有模块

I followed the instructions from here , and it seems to have fixed it. 我按照这里的指示进行操作,似乎已经解决了。

Now my $PATH has /Users/%USERPROFILE%/.node/bin included in it. 现在,我的$ PATH中包含/Users/%USERPROFILE%/.node/bin

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM