gpt4 book ai didi

linux - npm 安装出错

转载 作者:塔克拉玛干 更新时间:2023-11-03 01:51:31 25 4
gpt4 key购买 nike

我正在尝试通过终端安装 npm 包并收到以下错误。在 npm github 上尝试了所有解决方案,但没有一个有效。

删除 node_modules 并运行

npm install

再次,但仍然存在错误。

npm ERR! Error: ENOENT, open
'/var/www/simulator/node_modules/express/node_modules/proxy-addr/node_modules/forwarded/README.md'
npm ERR! If you need help, you may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-@googlegroups.com>

npm ERR! System Linux 3.13.0-55-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! cwd /var/www/simulator
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
npm ERR! path /var/www/simulator/node_modules/express/node_modules/proxy-addr/node_modules/forwarded/README.md
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! EEXIST, mkdir '/var/www/simulator/node_modules/express/node_modules/proxy-addr/node_modules/ipaddr.js'
File exists: /var/www/simulator/node_modules/express/node_modules/proxy-addr/node_modules/ipaddr.js
Move it away, and try again.

npm ERR! System Linux 3.13.0-55-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! cwd /var/www/simulator
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
npm ERR! path /var/www/simulator/node_modules/express/node_modules/proxy-addr/node_modules/ipaddr.js
npm ERR! fstream_path /var/www/simulator/node_modules/express/node_modules/proxy-addr/node_modules/ipaddr.js/.npmignore
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! code EEXIST
npm ERR! errno 47
npm ERR! fstream_stack /usr/lib/nodejs/fstream/lib/writer.js:171:23
npm ERR! fstream_stack /usr/lib/nodejs/mkdirp/index.js:37:53
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm http GET https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-2.2.2.tgz
npm ERR! Error: UNKNOWN, symlink '../mime/cli.js'
npm ERR! If you need help, you may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-@googlegroups.com>

npm ERR! System Linux 3.13.0-55-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! cwd /var/www/simulator
npm ERR! node -v v0.10.25
npm ERR!

npm -v 1.3.10
npm ERR! path ../mime/cli.js
npm ERR! code UNKNOWN
npm ERR! errno -1

npm ERR! error rolling back Error: UNKNOWN, unlink '/var/www/simulator/node_modules/request/node_modules/tough-cookie/lib/pubsuffix.js'
npm ERR! error rolling back request@2.69.0 { [Error: UNKNOWN, unlink '/var/www/simulator/node_modules/request/node_modules/tough-cookie/lib/pubsuffix.js']
npm ERR! error rolling back errno: -1,
npm ERR! error rolling back code: 'UNKNOWN',
npm ERR! error rolling back path: '/var/www/simulator/node_modules/request/node_modules/tough-cookie/lib/pubsuffix.js' }
npm ERR! Error: ENOENT, chmod '/var/www/simulator/node_modules/request/node_modules/qs/test/parse.js'
npm ERR! If you need help, you may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-@googlegroups.com>

npm ERR! System Linux 3.13.0-55-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! cwd /var/www/simulator
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
npm ERR! path /var/www/simulator/node_modules/request/node_modules/qs/test/parse.js
npm ERR! fstream_path /var/www/simulator/node_modules/request/node_modules/qs/test/parse.js
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! fstream_finish_call chmod
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack /usr/lib/nodejs/fstream/lib/writer.js:305:19
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)

npm ERR! error rolling back Error: UNKNOWN, unlink '/var/www/simulator/node_modules/jade/node_modules/uglify-js/tools/domprops.json'
npm ERR! error rolling back jade@1.11.0 { [Error: UNKNOWN, unlink '/var/www/simulator/node_modules/jade/node_modules/uglify-js/tools/domprops.json']
npm ERR! error rolling back errno: -1,
npm ERR! error rolling back code: 'UNKNOWN',
npm ERR! error rolling back path: '/var/www/simulator/node_modules/jade/node_modules/uglify-js/tools/domprops.json' }
npm ERR! Error: ENOENT, utime '/var/www/simulator/node_modules/jade/node_modules/clean-css/lib/tokenizer/extract-properties.js'
npm ERR! If you need help, you may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-@googlegroups.com>

npm ERR! System Linux 3.13.0-55-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! cwd /var/www/simulator
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
npm ERR! path /var/www/simulator/node_modules/jade/node_modules/clean-css/lib/tokenizer/extract-properties.js
npm ERR! fstream_path /var/www/simulator/node_modules/jade/node_modules/clean-css/lib/tokenizer/extract-properties.js
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! fstream_finish_call utimes
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack /usr/lib/nodejs/fstream/lib/writer.js:305:19
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm ERR! EEXIST, mkdir '/var/www/simulator/node_modules/jade/node_modules/jstransformer/node_modules/promise/node_modules/asap'
File exists: /var/www/simulator/node_modules/jade/node_modules/jstransformer/node_modules/promise/node_modules/asap
Move it away, and try again.

npm ERR! System Linux 3.13.0-55-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! cwd /var/www/simulator
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
npm ERR! path /var/www/simulator/node_modules/jade/node_modules/jstransformer/node_modules/promise/node_modules/asap
npm ERR! fstream_path /var/www/simulator/node_modules/jade/node_modules/jstransformer/node_modules/promise/node_modules/asap/asap.js
npm ERR! fstream_type File


npm ERR! fstream_class FileWriter
npm ERR! code EEXIST
npm ERR! errno 47
npm ERR! fstream_stack /usr/lib/nodejs/fstream/lib/writer.js:171:23
npm ERR! fstream_stack /usr/lib/nodejs/mkdirp/index.js:37:53
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)

npm ERR! error rolling back Error: ENOTEMPTY, rmdir '/var/www/simulator/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema'
npm ERR! error rolling back http-signature@1.1.1 { [Error: ENOTEMPTY, rmdir '/var/www/simulator/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/js
on-schema']
npm ERR! error rolling back errno: 53,
npm ERR! error rolling back code: 'ENOTEMPTY',
npm ERR! error rolling back path: '/var/www/simulator/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema' }

npm ERR! error rolling back Error: UNKNOWN, unlink '/var/www/simulator/node_modules/jade/node_modules/with/node_modules/acorn-globals/node_modules/acorn/dist/acorn_loose.js'
npm ERR! error rolling back with@4.0.3 { [Error: UNKNOWN, unlink '/var/www/simulator/node_modules/jade/node_modules/with/node_modules/acorn-globals/node_modules/acorn/dist/acorn_lo
ose.js']
npm ERR! error rolling back errno: -1,
npm ERR! error rolling back code: 'UNKNOWN',
npm ERR! error rolling back path: '/var/www/simulator/node_modules/jade/node_modules/with/node_modules/acorn-globals/node_modules/acorn/dist/acorn_loose.js' }

最佳答案

发生这种情况是因为您的主机是 Windows, guest 是 Linux。如果它们都是基于 *nix 的,那么您将不会遇到此问题。

有两种选择可以解决这个问题。

1.npm config set bin-links false(但这会阻止您使用 npm install -g 来安装全局二进制文件。)

2.npm install --no-bin-links(看来你自己想出来了,我也推荐这个方法)

关于linux - npm 安装出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35272517/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com