如何在expressJS上修复未满足的依赖错误

时间:2022-10-16 09:36:59

I'm getting started with express JS and NodeJs using the ExpressJSGuide

我开始使用express JS和NodeJs使用ExpressJSGuide

I'm stuck at the

我在

npm ls

npm ls

part, it throws the following errors

部分,它抛出以下错误

└─┬ express@3.5.0 ├── UNMET DEPENDENCY buffer-crc32 0.2.1

└─┬express@3.5.0├──未满足的依赖buffer-crc32 0.2.1

├── UNMET DEPENDENCY commander 1.3.2

├──未满足的依赖指挥官1.3.2

├── UNMET DEPENDENCY connect 2.14.1

├──未满足的依赖2.14.1连接

├── UNMET DEPENDENCY cookie 0.1.1

├──未满足的依赖饼干0.1.1

├── UNMET DEPENDENCY cookie-signature 1.0.3

├──未满足的依赖cookie-signature 1.0.3

├── UNMET DEPENDENCY debug >= 0.7.3 < 1

├──未满足的依赖调试> = 0.7.3 < 1

├── UNMET DEPENDENCY fresh 0.2.2

├──新鲜0.2.2未满足的依赖

├── UNMET DEPENDENCY merge-descriptors 0.0.2

├──未满足的依赖merge-descriptors发布

├── UNMET DEPENDENCY methods 0.1.0

├──0.1.0未满足的依赖关系的方法

├── UNMET DEPENDENCY mkdirp 0.3.5

├──未满足的依赖mkdirp 0.3.5

├── UNMET DEPENDENCY range-parser 1.0.0

├──未满足的依赖range-parser 1.0.0

└── UNMET DEPENDENCY send 0.2.0

└──未满足的依赖0.2.0发送

npm ERR! missing: connect@2.14.1, required by express@3.5.0

npm犯错!缺失:connect@2.14.1, express@3.5.0要求。

npm ERR! missing: commander@1.3.2, required by express@3.5.0

npm犯错!缺失:@1.3.2,express@3.5.0要求

npm ERR! missing: range-parser@1.0.0, required by express@3.5.0

npm犯错!缺失:range-parser@1.0.0, express@3.5.0要求

npm ERR! missing: mkdirp@0.3.5, required by express@3.5.0

npm犯错!缺失:mkdirp@0.3.5, express@3.5.0需要

npm ERR! missing: cookie@0.1.1, required by express@3.5.0

npm犯错!缺失:cookie@0.1.1, express@3.5.0要求

npm ERR! missing: buffer-crc32@0.2.1, required by express@3.5.0

npm犯错!缺失:buffer-crc32@0.2.1, express@3.5.0要求

npm ERR! missing: fresh@0.2.2, required by express@3.5.0

npm犯错!缺失:fresh@0.2.2, express@3.5.0需要

npm ERR! missing: methods@0.1.0, required by express@3.5.0

npm犯错!缺失:methods@0.1.0, express@3.5.0需要的

npm ERR! missing: send@0.2.0, required by express@3.5.0

npm犯错!缺失:send@0.2.0,由express@3.5.0要求

npm ERR! missing: cookie-signature@1.0.3, required by express@3.5.0

npm犯错!缺失:cookie-signature@1.0.3, express@3.5.0要求

npm ERR! missing: merge-descriptors@0.0.2, required by express@3.5.0

npm犯错!缺失:merge-descriptors@0.0.2, express@3.5.0要求

npm ERR! missing: debug@>= 0.7.3 < 1, required by express@3.5.0

npm犯错!缺失:debug@>= 0.7.3 < 1, express@3.5.0要求

npm ERR! not ok code 0

npm犯错!不是好的代码0

does anyone know how to fix this?

有人知道怎么解决这个问题吗?

Already tried

已经试过

npm install dependency-name

npm安装dependency-name

like

就像

npm install cookie-signature

npm安装cookie-signature

but it only thrown the following errors

但它只抛出了以下错误

npm WARN package.json express@3.5.0 No README data

npm警告包。无自述数据

npm WARN package.json cookie-signature@1.0.3 No README data

npm警告包。没有自述数据

npm http GET https://registry.npmjs.org/cookie-signature

npm http GET https://registry.npmjs.org/cookie-signature

npm http 200 https://registry.npmjs.org/cookie-signature

npm http 200 https://registry.npmjs.org/cookie-signature

npm http GET https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.3.tgz

npm http GET https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.3.tgz

npm http 200 https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.3.tgz

npm http 200 https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.3.tgz

npm ERR! Error: EPERM, chown '/misc/htdocs/hello-world/node_modules/cookie-signature/package.json'

npm犯错!错误:EPERM,乔恩/ misc /根/ hello world / node_modules cookie-signature / package.json '

npm ERR! { [Error: EPERM, chown '/misc/htdocs/hello-world/node_modules/cookie-signature/package.json']

npm犯错!{[错误:EPERM, chown '/misc/htdocs/hello-world/node_modules/ cooky -signature/package.json]

npm ERR! errno: 50,

npm犯错!errno:50,

npm ERR! code: 'EPERM',

npm犯错!代码:“EPERM”,

npm ERR! path: '/misc/htdocs/hello-world/node_modules/cookie-signature/package.json',

npm犯错!路径:/ misc /根/ hello world / node_modules cookie-signature / package.json ',

npm ERR! fstream_finish_call: 'chown',

npm犯错!fstream_finish_call:乔恩,

npm ERR! fstream_type: 'File',

npm犯错!fstream_type:“文件”,

npm ERR! fstream_path: '/misc/htdocs/hello-world/node_modules/cookie-signature/package.json',

npm犯错!fstream_path:“/ misc /根/ hello world / node_modules cookie-signature / package.json ',

npm ERR! fstream_class: 'FileWriter',

npm犯错!fstream_class:“FileWriter”,

npm ERR! fstream_stack:

npm犯错!fstream_stack:

npm ERR! [ '/usr/lib/node_modules/npm/node_modules/fstream/lib/writer.js:305:19',

npm犯错!(“/ usr / lib / node_modules / npm / node_modules / fstream / lib / writer.js:305:19”,

npm ERR! '/usr/lib/node_modules/npm/node_modules/graceful-fs/polyfills.js:133:7',

npm犯错!“/ usr / lib / node_modules / npm / node_modules / graceful-fs / polyfills.js:133:7”,

npm ERR! 'Object.oncomplete (fs.js:107:15)' ] }

npm犯错!的对象。oncomplete(fs.js:107:15)']}

npm ERR!

npm犯错!

npm ERR! Please try running this command again as root/Administrator.

npm犯错!请尝试再次作为root/Administrator运行此命令。

npm ERR! System Linux 2.6.32-431.5.1.el6.x86_64

npm犯错!Linux系统2.6.32-431.5.1.el6.x86_64

npm ERR! command "node" "/usr/bin/npm" "install" "cookie-signature"

npm犯错!命令“节点”/usr/bin/npm“安装”“cookie-signature”

npm ERR! cwd /misc/htdocs/hello-world

npm犯错!慢性消耗病/ misc /根/ hello world

npm ERR! node -v v0.10.26

npm犯错!节点- v v0.10.26

npm ERR! npm -v 1.4.6

npm犯错!npm - v 1.4.6

npm ERR! path /misc/htdocs/hello-world/node_modules/cookie-signature/package.json

npm犯错!路径/ misc /根/ hello world / node_modules cookie-signature / package.json

npm ERR! fstream_path /misc/htdocs/hello-world/node_modules/cookie-signature/package.json

npm犯错!fstream_path / misc /根/ hello world / node_modules cookie-signature / package.json

npm ERR! fstream_type File

npm犯错!fstream_type文件

npm ERR! fstream_class FileWriter

npm犯错!fstream_class FileWriter

npm ERR! fstream_finish_call chown

npm犯错!fstream_finish_call乔恩

npm ERR! code EPERM

npm犯错!代码EPERM

npm ERR! errno 50

npm犯错!errno 50

npm ERR! stack Error: EPERM, chown '/misc/htdocs/hello-world/node_modules/cookie-signature/package.json'

npm犯错!栈错误:EPERM, chown '/misc/htdocs/hello-world/node_modules/ cooky -signature/package.json'

npm ERR! fstream_stack /usr/lib/node_modules/npm/node_modules/fstream/lib/writer.js:305:19

npm犯错!fstream_stack /usr/lib/node_modules / npm / node_modules / fstream / lib / writer.js:305:19

npm ERR! fstream_stack /usr/lib/node_modules/npm/node_modules/graceful-fs/polyfills.js:133:7

npm犯错!fstream_stack /usr/lib/node_modules / npm node_modules / graceful-fs / polyfills.js:133:7

npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)

npm犯错!fstream_stack对象。oncomplete(fs.js 107:15):

npm ERR!

npm犯错!

npm ERR! Additional logging details can be found in:

npm犯错!更多的日志详细信息可以在:

npm ERR! /misc/htdocs/hello-world/npm-debug.log

npm犯错!/ misc /根/ hello world / npm-debug.log

npm ERR! not ok code 0

npm犯错!不是好的代码0

3 个解决方案

#1


4  

You might try to run npm cache clean. I had similar issues and this solved it for me.

您可以尝试运行npm缓存清理。我也遇到过类似的问题,这就帮我解决了。

#2


0  

The first error says that you do not have permission to execute chown on the file package.json. I'm assuming npm is trying to change ownership of that file to do it's thing.

第一个错误表示您没有权限在file package.json上执行chown。我假设npm试图改变文件的所有权来做它的事情。

npm ERR! Error: EPERM, chown '/misc/htdocs/hello-world/node_modules/cookie signature/package.json'

In short, it looks like you want to execute npm install with sudo:

简而言之,看起来您希望使用sudo执行npm安装:

sudo npm install dependency-name

Or as root if you don't have sudo:

或者作为根,如果你没有sudo:

su
# type your root password at the prompt
npm install dependency-name

#3


0  

Try this:

试试这个:

sudo npm cache clean -f 
sudo npm install -g n 
sudo n stable 

Actually what it does is, it updates your npm.

实际上它所做的是更新npm。

#1


4  

You might try to run npm cache clean. I had similar issues and this solved it for me.

您可以尝试运行npm缓存清理。我也遇到过类似的问题,这就帮我解决了。

#2


0  

The first error says that you do not have permission to execute chown on the file package.json. I'm assuming npm is trying to change ownership of that file to do it's thing.

第一个错误表示您没有权限在file package.json上执行chown。我假设npm试图改变文件的所有权来做它的事情。

npm ERR! Error: EPERM, chown '/misc/htdocs/hello-world/node_modules/cookie signature/package.json'

In short, it looks like you want to execute npm install with sudo:

简而言之,看起来您希望使用sudo执行npm安装:

sudo npm install dependency-name

Or as root if you don't have sudo:

或者作为根,如果你没有sudo:

su
# type your root password at the prompt
npm install dependency-name

#3


0  

Try this:

试试这个:

sudo npm cache clean -f 
sudo npm install -g n 
sudo n stable 

Actually what it does is, it updates your npm.

实际上它所做的是更新npm。