当node已经用前缀编译时如何安装npm

发布于 2025-01-03 14:09:56 字数 407 浏览 3 评论 0原文

我已经使用 git 存储库从源代码安装了节点。节点当前路径为 /Users/toutpt/makina/cubes/parts/nodejs/bin/node

现在我得到了 npm 的源,但我无法在安装时指定使用此节点。每个谷歌结果都指出我从 /usr/bin/node 链接它或添加 /Users/toutpt/makina/cubes/parts/nodejs/bin 作为全局路径的一部分

我所有的尝试都给了我同样的错误: bin/npm: 第 5 行:节点:找不到命令

我不想要,并且由于系统限制,我无法将其在我的系统上设置为全局。我想让每个项目都使用它自己的 NPM 节点版本。

我想通过使用 npm 的路径来使用它: /用户/toutpt/makina/cubes/parts/npm/bin/npm install ...

I have installed node from source using the git repository. The current path of node is
/Users/toutpt/makina/cubes/parts/nodejs/bin/node

Now I get the source of npm and I can't specify at install tho use this node. Every google results point me out to link it from /usr/bin/node or to add /Users/toutpt/makina/cubes/parts/nodejs/bin as part of global PATH

All my try give me the same error:
bin/npm: line 5: node: command not found

I don't want and I can't make it global on my system because of system restriction. I would like to have each project use it's own version of node so of NPM.

I want to use npm by using it's path:
/Users/toutpt/makina/cubes/parts/npm/bin/npm install ...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

月依秋水 2025-01-10 14:09:56

由于您的用例是:

我想让每个项目使用它自己的 NPM 节点版本

也许是 节点版本管理软件 ala n (https://github.com/visionmedia/n) 或 nvm (github.com /creationix/nvm) 对你很有用。

As your use-case is:

I would like to have each project use it's own version of node so of NPM

Maybe a node version management software ala n (https://github.com/visionmedia/n) or nvm (github.com/creationix/nvm) would be useful for you.

超可爱的懒熊 2025-01-10 14:09:56

不确定是否有帮助,但我会这样做:
转到你提到的路径

curl http://npmjs.org/install.sh | sh

Not sure if its help but I would do this:
go to the path you mentioned then

curl http://npmjs.org/install.sh | sh
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文