简体   繁体   English

尝试npm安装时出现安装错误

[英]Installing error when trying to npm install

I'm new to node.js, and I've been trying to npm install some modules - namely, cheerio, express and request. 我是node.js的新手,并且我一直在尝试npm安装一些模块-即cheerio,express和request。 But I keep getting this: 但我不断得到这个:

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

But the folder node_modules still appears in my directory. 但是文件夹node_modules仍然出现在我的目录中。 So OK, I try stuff on it. 好吧,我尝试尝试一下。 My main.js file has the following: 我的main.js文件具有以下内容:

var request = require('request');

console.log("Hello, World!")

That's all it's got. 仅此而已。 Immediately, it breaks: 立即中断:

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)

Help? 救命?

Since you're using npm version 2.15.8, windows has a limit of folder depth. 由于您使用的是npm 2.15.8版本,因此Windows具有文件夹深度的限制。 Update your npm to npm@3 . 将您的npm更新为npm@3

npm install -g npm@3 

npm cache clear 

Then, delete your node_modules/ before installing the npm modules( cheerio , express , request ) 然后,在安装npm模块( cheerioexpressrequest )之前,删除您的node_modules/

Source: BountySource 资料来源:BountySource

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM