npm本地安装
过去,当我使用 npm(>=1.0) 安装软件包时,它们会在本地安装,但现在不再了。
我的设置:
首先我使用nvm来安装node.js。
我的操作系统:
alfred@alfred-laptop:~/node/so/6513101$ cat /etc/lsb-release DISTRIB_ID=Ubuntu
; DISTRIB_RELEASE=10.10 DISTRIB_CODENAME=特立独行 DISTRIB_DESCRIPTION="Ubuntu 10.10"我的节点版本:
alfred@alfred-laptop:~/node/so/6513101$ 节点 -v v0.4.8
我的 npm 版本:
alfred@alfred-laptop:~/node/so/6513101$ npm -v 1.0.15
安装随机包
alfred@alfred-laptop:~/node/so/6513101$ npm install notifo
[email protected] ../../../node_modules/notifo
过去它会安装到同一个目录中,但现在不再安装在同一个目录中了。我的 npm/node.js 是否已损坏,或者我是否丢失了某些内容,或者 npm 不再安装本地软件包(在同一文件夹 => ~/node/so/6513101/node_modules
内),我认为这是一个很酷的功能,因为我可以捆绑
我的所有依赖项,这样其他用户就不必安装 npm 来使用我的代码(我仍然相信用户应该安装 npm,因为它是一个很棒的产品)。 bundle
命令消失了,所以我无法使用它?有人可以向我解释一下发生了什么事吗?
In the past when I installed packages using npm(>=1.0) they would be installed locally, but not anymore.
My setup:
First I use nvm to install node.js.
My operating System:
alfred@alfred-laptop:~/node/so/6513101$ cat /etc/lsb-release DISTRIB_ID=Ubuntu<br> DISTRIB_RELEASE=10.10 DISTRIB_CODENAME=maverick DISTRIB_DESCRIPTION="Ubuntu 10.10"
My node version:
alfred@alfred-laptop:~/node/so/6513101$ node -v v0.4.8
My npm version:
alfred@alfred-laptop:~/node/so/6513101$ npm -v 1.0.15
Installing random package
alfred@alfred-laptop:~/node/so/6513101$ npm install notifo
[email protected] ../../../node_modules/notifo
In the past it would install into the same directory but it does not install in the same directory anymore. is my npm/node.js broken or am I missing something or does npm not anymore install local packages(inside same folder => ~/node/so/6513101/node_modules
) which I thought was a cool feature because I could bundle
all my dependencies so that other users did not have to install npm to use my code(I still believe users should install npm because it is a great product). The bundle
command is gone so I can't use that? Could someone please explain to me what is going on?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
npm 沿着文件夹树向上查找,直到找到
node_modules
或package.json
并将其用作根。npm root
打印出什么?如果您
mkdir node_modules
或创建 package.json 文件,那么它将使用 cwd。编辑:我不会看到您在这里发布的更新。为了获得更好的结果,只需将所有内容发布到 github 问题中,然后让我们在那里提供支持。
npm walks up the folder tree until it finds a
node_modules
or apackage.json
and uses that as the root. What doesnpm root
print out?If you
mkdir node_modules
or create a package.json file, then it'll use the cwd.EDIT: I won't see updates you post here. For better results, just post everything in the github issue, and let's do the support over there.