找不到 NPM -bash 命令
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26125358/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
NPM -bash command not found
提问by HelloWorld
I am trying to run through nodeschool.io exercises. I am having trouble running their packages.
我正在尝试通过 nodeschool.io 练习。我在运行他们的包时遇到问题。
The first package I installed:
我安装的第一个包:
$ npm install -g learnyounode
$ learnyounode
Runs the package with the command learnyounode
使用命令运行包 learnyounode
Every other package on their site I tried installing and can't run the program with the proper command in the command line, ex:
我尝试安装他们网站上的所有其他软件包,但无法在命令行中使用正确的命令运行该程序,例如:
$ npm install -g functional-javascript-workshop@latest
$ /Users/name/npm/bin/functional-javascript -> /Users/name/npm/lib/node_modules/functional-javascript-workshop/functional-javascript.js
/Users/name/npm/bin/functional-javascript-workshop -> /Users/name/npm/lib/node_modules/functional-javascript-workshop/functional-javascript.js
[email protected] /Users/name/npm/lib/node_modules/functional-javascript-workshop
├── [email protected] ([email protected], [email protected])
└── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
$ functional-javascript-workshop
$ -bash: functional-javascript-workshop: command not found
Here is a link to the package I am trying to install in the example: functional-javascript-workshop
这是我尝试在示例中安装的包的链接:functional-javascript-workshop
As you can see, I am getting the message
-bash - command not found
如您所见,我收到了消息
-bash - command not found
Looking at other posts with similar problems, I ran the following commands to see my path and where the packages are being saved:
查看其他有类似问题的帖子,我运行了以下命令来查看我的路径以及保存包的位置:
$ which node
$ /usr/local/bin/node
$ which npm
$ /usr/local/bin/npm
$PATH
$ Users/name/.rbenv/shims:/Users/name/.rbenv/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin: No such file or directory
Steps I tried:
我试过的步骤:
- Uninstall/Reinstall node using brew commands
- global update npm's ($ npm update -g)
- 使用 brew 命令卸载/重新安装节点
- 全局更新 npm ($ npm update -g)
It looks like my node-modules are being installed at /Users/name/npm/lib/node_modules
I'm not sure though how to give my command line access or a way of looking into that path for the command to start the program.
看起来我的节点模块安装在/Users/name/npm/lib/node_modules
我不确定如何授予我的命令行访问权限或查看该路径以启动程序的命令的方式。
采纳答案by jasonleonhard
The functional-javascript-workshop
executable is in /Users/name/npm/bin
, which is not in your PATH variable, add this to your .bashrc
or .bash_profile
file:
该functional-javascript-workshop
可执行文件是/Users/name/npm/bin
,这是不是在你的PATH变量,添加到您的.bashrc
或.bash_profile
文件:
export PATH=$PATH:/Users/name/npm/bin
Then you should be able to run functional-javascript-workshop
然后你应该可以运行 functional-javascript-workshop