找不到NPM -bash命令 [英] NPM -bash command not found

查看:165
本文介绍了找不到NPM -bash命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试执行nodeschool.io练习.我在运行他们的软件包时遇到了麻烦.

I am trying to run through nodeschool.io exercises. I am having trouble running their packages.

我安装的第一个软件包:

The first package I installed:

$ npm install -g learnyounode
$ 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
functional-javascript-workshop@0.0.27 /Users/name/npm/lib/node_modules/functional-javascript-workshop
├── lorem-ipsum@0.1.1 (inflection@1.2.7, optimist@0.3.7)
└── workshopper@0.7.2 (map-async@0.1.1, tuple-stream@0.0.2, split@0.2.10, through@2.3.6, mkdirp@0.3.5, colors-tmpl@0.1.0, xtend@2.1.2, terminal-menu@0.2.0, optimist@0.6.1, msee@0.1.1)

$ functional-javascript-workshop
$ -bash: functional-javascript-workshop: command not found

以下是我尝试在示例中安装的软件包的链接: functional-javascript-workshop

Here is a link to the package I am trying to install in the example: functional-javascript-workshop

如您所见,我收到消息 -bash - command not found

As you can see, I am getting the message -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

我尝试过的步骤:

  • 使用brew命令卸载/重新安装节点
  • 全局更新npm($ npm更新-g)

看来我的节点模块已安装在/Users/name/npm/lib/node_modules上,我不确定该如何授予我的命令行访问权限,也无法确定该命令启动程序的路径.

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.

推荐答案

functional-javascript-workshop可执行文件位于/Users/name/npm/bin中,该文件不在您的PATH变量中,请将其添加到您的.bashrc.bash_profile文件中:

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:

export PATH=$PATH:/Users/name/npm/bin

然后您应该可以运行functional-javascript-workshop

这篇关于找不到NPM -bash命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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