我使用npmnpm 查看已安装模块不了模块,请问这是怎么一回事

[root@wlan-cloudserver10 wlanpub]# npm install -g
kerberos@0.0.15 install /usr/local/lib/node_modules/wlanpub/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos
(node-gyp rebuild) || (exit 0)
gyp WARN EACCES user “wlanuser” does not have permission to access the dev dir “/root/.node-gyp/0.12.6”
gyp WARN EACCES attempting to reinstall using temporary dev dir “/usr/local/lib/node_modules/wlanpub/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/.node-gyp”
gyp WARN install got an error, rolling back install
gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: node-v0.12.6.tar.gz local checksum c2edb3c54dd0faf28afaea2cf631bc2eeb8 not match remote 7a3b5acdee8edbfdea44b231e42274ffb008141ffa19ad2
gyp ERR! stack
at deref (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/install.js:307:20)
gyp ERR! stack
at IncomingMessage.&anonymous& (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/install.js:348:13)
gyp ERR! stack
at IncomingMessage.emit (events.js:129:20)
gyp ERR! stack
at _stream_readable.js:908:16
gyp ERR! stack
at process._tickCallback (node.js:355:11)
gyp ERR! System Linux 2.6.32-504.el6.x86_64
gyp ERR! command “node” “/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js” “rebuild”
gyp ERR! cwd /usr/local/lib/node_modules/wlanpub/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos
gyp ERR! node -v v0.12.6
gyp ERR! node-gyp -v v2.0.1
gyp ERR! not ok
wlanpub@0.1.1 /usr/local/lib/node_modules/wlanpub
├── uuid@2.0.1
├── redis@0.12.1
├── amqp@0.2.4 (lodash@1.3.1)
└── mongoose@4.1.12 (regexp-clone@0.0.1, sliced@0.0.5, muri@1.0.0, hooks-fixed@1.1.0, mpromise@0.5.4, kareem@1.0.1, mpath@0.1.1, async@0.9.0, ms@0.1.0, bson@0.4.19, mquery@1.6.3, mongodb@2.0.46)疑问:
我在模块wlanpub目录下执行npm install -g,意图将依赖库直接安装在 全局路径下即/usr/local/lib/node_modules/,这样安装的依赖库也可以供其他模块项目使用,但实际情况是其在全局目录下加了一级模块目录/usr/local/lib/node_modules/wlanpub/node_modules/,为什么会这样?
我不想通过npm install直接装在项目模块目录下(因为只能当前项目用)附:1、linux环境
[root@wlan-cloudserver10 webserver2]# node -v
[root@wlan-cloudserver10 webserver2]# npm -v
[root@wlan-cloudserver10 webserver2]# npm root -g
/usr/local/lib/node_modules
[root@wlan-cloudserver10 webserver2]#2、package.json
&name&: &wlanpub&,
&version&: &0.1.1&,
&description&: &H3C WLAN Cloud-plat public module&,
&main&: &wlanpub.js&,
&scripts&: {
&test&: “echo “Error: no test specified” && exit 1”
&keywords&: [
“wlanpub”
&repository&: {
&type&: &git&,
&url&: “”
&homepage&: &&,
&_id&: &wlanpub@0.1.1&,
&dependencies&: {
&amqp&: &~0.2.4&,
&uuid&: &~2.0.1&,
&redis&: &~0.12.1&,
&mongoose&: “~4.1.0”
&author&: &Juneja&,
&license&: “ISC”NodeJS(8)
默认安装完node.js后会自己安装npm,通过npm下载全局模块默认安装到C:\Users\wangyc\AppData\Roaming目录下,主要有两个文件夹:npm、npm-cache
npm:下载的具体模块
npm-cache:npm的缓存文件
如果需要修改此两个文件的目录,甚至将将这两个文件拷贝到无法连网的机器上呢?
使用命令:
npm config set prefix &D:\nodejs\npm& npm config set cache &D:\nodejs\npm-cache&
由于node全局模块大多数都是提供命令行访问的,所以还要把&D:\nodejs\npm
加到系统PATH里面,注意同时需要将以前的默认路径从PATH中删除。
转载来源:
参考知识库
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:205448次
积分:2108
积分:2108
排名:第11920名
原创:83篇
转载:19篇
评论:22条
文章:20篇
阅读:37306
(20)(1)(2)(1)(3)(4)(1)(1)(1)(3)(3)(2)(9)(17)(6)(2)(1)(2)(3)(1)(3)(4)(1)(1)(1)Windows 下 npm 模块安装的位置太奇葩了 - V2EX
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
已注册用户请 &
PPA for Ubuntu
> ppa:chris-lea/node.js
Windows 下 npm 模块安装的位置太奇葩了
03:13:22 +08:00 · 6374 次点击
用 npm install express -g 安装 express ,结果 express 安装到了%home%\npm\node_modules 里面,express 依赖的模块安装到了%home%\npm\node_modules\express\node_modules 里面。。。后来安装另一个模块,结果这个模块依赖的包又安装到了这个模块的目录里面的node_modules目录里。。。而且和这个有重复的。。。真不知道干嘛设计成这个样子。。。这样模块岂不是不能重用了。linux里也是这样的吗
5 回复 &| &直到
08:00:00 +08:00
& & 03:14:52 +08:00
是不是应该统一安装到 %home%\npm\node_modules 里面?但是我手动挪过去之后,运行一个模块的时候就找不到依赖的模块了。。
& & 03:31:35 +08:00
npm和包不是用目录来区分版本的,也就是说不是 `node_modules/connect/1.8/` 这种目录结构。
所以,依赖必须各管各的,要不版本冲突了。
& & 10:44:14 +08:00
之前也研究探讨过NODE模块在WIN下的路径问题..
对于无法模块重用, 虽然浪费了些空间其实问题不大, 安装也方便
不过对于路径的定义还是持怀疑态度的,
在下经过修改后路径成了这样:
nodejs/
|-- node.exe
|-- npm.cmd
|-- lessc.cmd
|-- node_modules/
|
|-- npm/
|
|-- less/
|
|-- glob/
|
`-- other_modules/
`-- npm_cache/
path添加nodejs/目录即可
另外WIN下默认安装node后安装的全局模块-g 无法require到, 可以添加NODE_PATH变量指向到nodejs/node_mudules
& & 01:42:57 +08:00
npm 的依赖包一直是放在 模块目录/node_modules 的好吧!
& & 13:45:18 +08:00
到npm官方下载win包 替换默认node安装的npm
& · & 1062 人在线 & 最高记录 1847 & · &
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.7.3 · 53ms · UTC 06:52 · PVG 14:52 · LAX 23:52 · JFK 02:52? Do have faith in what you're doing.手机腾讯>>
手机门户>>
热门点击>>
电脑上wap网:nodejs的npm安装模块时候报错:npm ERR! Error: CERT_NOT_YET_VALID的解决方法 - 包子博客 _ 关注互联网前端、开发、SEO、移动互联网应用技术
nodejs的npm安装模块时候报错:npm ERR! Error: CERT_NOT_YET_VALID的解决方法 - 包子博客 _ 关注互联网前端、开发、SEO、移动互联网应用技术
haodewap.netnode jenkins npm install -g cannot find module config-chain [结詹金斯NPM安装- G不能找到模块配置链] - 问题-字节技术
node jenkins npm install -g cannot find module config-chain
结詹金斯NPM安装- G不能找到模块配置链
问题 (Question)
I configured the node plugins on jenkins to install grunt and bower globally.
When i use it on a project npm install is executed:
npm install -g bower@~1.2.8 grunt-cli@~0.1.11
Unfortunally it breaks immediately returning the following error:
module.js:333
Error: Cannot find module 'config-chain'
at Function.Module._resolveFilename (module.js:331:15)
at Function.Module._load (module.js:273:25)
at Module.require (module.js:357:17)
at require (module.js:373:17)
at Object.&anonymous& (/Users/Shared/Jenkins/Home/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/Node_0.11.10/lib/node_modules/npm/node_modules/npmconf/npmconf.js:2:10)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:349:32)
at Function.Module._load (module.js:305:12)
at Module.require (module.js:357:17)
I dont think config-chain is an extra plugin necessary to install and should be there.
Any ideas how to fix this?
我对詹金斯的节点配置插件安装的呼噜声和鲍尔全局。当我使用它的一个项目,NPM安装执行: npm install -g bower@~1.2.8 grunt-cli@~0.1.11
不幸的会立即返回下列错误:module.js:333
Error: Cannot find module 'config-chain'
at Function.Module._resolveFilename (module.js:331:15)
at Function.Module._load (module.js:273:25)
at Module.require (module.js:357:17)
at require (module.js:373:17)
at Object.&anonymous& (/Users/Shared/Jenkins/Home/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/Node_0.11.10/lib/node_modules/npm/node_modules/npmconf/npmconf.js:2:10)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:349:32)
at Function.Module._load (module.js:305:12)
at Module.require (module.js:357:17)
我想配置链是一个额外的插件需要安装应该有。任何想法如何解决这个问题?
最佳答案 (Best Answer)
config-chain is npm dependency, so chances are that your npm installation is broken.
Try to reinstall it, or use one of npm forks if npm itself isn't installable on your system for some reason.
config-chain是新公共管理的依赖,所以机会是你安装了新公共管理。尝试重新安装它,或使用一个“福克斯如果NPM本身并不是安装在您的系统上的一些原因。
本文翻译自StackoverFlow,英语好的童鞋可直接参考原文:

我要回帖

更多关于 npm 删除模块 的文章

 

随机推荐