尝试npm安装时安装错误

时间:2016-08-10 05:46:49

标签: node.js

我是node.js的新手,我一直试图安装一些模块 - 即cheerio,express和request。但我一直这样说:

npm WARN package.json node-web-scrape@0.0.1 No repository field.
npm WARN package.json node-web-scrape@0.0.1 No README data
npm WARN package.json node-web-scrape@0.0.1 No license field.
npm WARN retry will retry, error on last attempt: Error: EBUSY: resource busy or locked, rename 'C:\Users\user\AppData\Local\Temp\npm-16500-38020820\registry.npmjs.org\jsdom\-\jsdom-7.2.2.tgz.1538180439' -> 'C:\Users\user\AppData\Local\Temp\npm-16500-38020820\registry.npmjs.org\jsdom\-\jsdom-7.2.2.tgz'
npm ERR! Windows_NT 10.0.10586
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "cheerio"
npm ERR! node v4.4.7
npm ERR! npm  v2.15.8

但是文件夹node_modules仍然出现在我的目录中。好吧,我试试吧。我的main.js文件包含以下内容:

var request = require('request');

console.log("Hello, World!")

这一切都得到了。它立刻就破了:

C:\Users\user\Documents\Crawler>node main
module.js:327
    throw err;
    ^

Error: Cannot find module 'process-nextick-args'
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (C:\Users\user\Documents\Crawler\node_modules\request\node_modules\bl\node_modules\readable-stream\lib\_stream_duplex.js:21:23)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)

帮助?

1 个答案:

答案 0 :(得分:0)

由于您使用的是npm版本2.15.8,因此Windows具有文件夹深度限制。将您的npm更新为npm@3

npm install -g npm@3 

npm cache clear 

然后,在安装npm模块(node_modules/cheerioexpress)之前删除request

资料来源:BountySource