为 Node.js 安装 NPM 时出错
我正在尝试使用 这个要点
在 npm
上运行 sudo make install
后,我不断收到此错误,
$ sudo make install
! [ -d .git ] || git submodule update --init --recursive
node cli.js install -g -f
bash: node: command not found
make: *** [install] Error 127
我知道这是 bash
的问题,但我不太擅长 bash。
EDIT
在终端中运行 node
命令会按预期显示 node
shell
I'm trying to install npm
on ubuntu 11.04 using the "git all the way" method found in this gist
I keep getting this error after running sudo make install
on npm
$ sudo make install
! [ -d .git ] || git submodule update --init --recursive
node cli.js install -g -f
bash: node: command not found
make: *** [install] Error 127
I know this is something wrong with bash
, but I'm not very good with bash.
EDIT
running the node
command in the terminal brings up the node
shell
as expected
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
您的问题是,当您 sudo 时,您没有获取相同的 bashrc 文件(或设置 PATH 和/或 NODE_PATH 的任何内容),因此系统无法找到节点。
我猜想
sudo node
不会工作。您需要按照@Ken的建议导出NODE_PATH,同时进行SUDOING:
编辑:以使用下面评论中的PATH
Your problem is that when you sudo, you are not sourcing the same bashrc file (or whatever is setting your PATH and/or NODE_PATH), and so the system cannot find node.
I would guess that
sudo node
won't work.You need to export your NODE_PATH as @Ken suggested, WHILE SUDOING:
EDIT: to use PATH as worked in comments below
确保在安装 npm 之前导出 NODE_PATH。
Make sure you export NODE_PATH before installing npm.
看起来你没有安装节点。您首先需要节点 - 然后是节点包管理器(NPM)。
Looks like you don't have node installed. You need node first - then the node package manager (NPM).
此页面说明了包括 npm 在内的完整节点安装(步骤 4)。
This page illustrates the complete node installation including npm (step 4).
就像有人提到的 - 为什么只使用 yum
Like someone mentioned - why just use yum