使用命令
npm install bcrypt
错误:
npm ERR! code 7
npm ERR! path /home/animagnoa/git/learn-reactjs-nodejs/node_modules/bcrypt
npm ERR! command failed
npm ERR! command sh -c node-pre-gyp install --fallback-to-build
npm ERR! A complete log of this run can be found in: /home/animagnoa/.npm/_logs/2024-02-04T13_26_18_519Z-debug-0.log
操作系统 Ubuntu 22.04
依赖关系:
"dependencies": {
"@mapbox/node-pre-gyp": "^1.0.11",
"express": "^4.18.2",
"express-validator": "^7.0.1",
"install": "^0.13.0",
"jsonwebtoken": "^9.0.2",
"mongoose": "^8.1.1",
"node-pre-gyp": "^0.17.0",
"nodemon": "^3.0.3"
}
版本:
node -v && npm -v
v20.11.0
10.2.4
日志
2024-02-04T13_26_18_519Z-debug-0.log
:
0 verbose cli /snap/node/8169/bin/node /snap/node/8169/bin/npm
1 info using [email protected]
2 info using [email protected]
3 timing npm:load:whichnode Completed in 1ms
4 timing config:load:defaults Completed in 1ms
5 timing config:load:file:/snap/node/8169/lib/node_modules/npm/npmrc Completed in 0ms
6 timing config:load:builtin Completed in 0ms
7 timing config:load:cli Completed in 2ms
8 timing config:load:env Completed in 0ms
9 timing config:load:file:/home/animagnoa/git/learn-reactjs-nodejs/.npmrc Completed in 0ms
10 timing config:load:project Completed in 1ms
11 timing config:load:file:/home/animagnoa/.npmrc Completed in 0ms
12 timing config:load:user Completed in 0ms
13 timing config:load:file:/snap/node/8169/etc/npmrc Completed in 1ms
14 timing config:load:global Completed in 1ms
15 timing config:load:setEnvs Completed in 1ms
16 timing config:load Completed in 6ms
17 timing npm:load:configload Completed in 6ms
18 timing config:load:flatten Completed in 2ms
19 timing npm:load:mkdirpcache Completed in 0ms
20 timing npm:load:mkdirplogs Completed in 1ms
21 verbose title npm install bcrypt
22 verbose argv "install" "bcrypt"
23 timing npm:load:setTitle Completed in 0ms
24 timing npm:load:display Completed in 0ms
25 verbose logfile logs-max:10 dir:/home/animagnoa/.npm/_logs/2024-02-04T13_26_18_519Z-
26 verbose logfile /home/animagnoa/.npm/_logs/2024-02-04T13_26_18_519Z-debug-0.log
27 timing npm:load:logFile Completed in 6ms
28 timing npm:load:timers Completed in 0ms
29 timing npm:load:configScope Completed in 0ms
30 timing npm:load Completed in 24ms
31 timing arborist:ctor Completed in 0ms
32 silly logfile start cleaning logs, removing 1 files
33 silly logfile done cleaning log files
34 timing idealTree:init Completed in 66ms
35 timing idealTree:userRequests Completed in 1ms
36 silly idealTree buildDeps
37 silly fetch manifest bcrypt@*
38 verbose shrinkwrap failed to load node_modules/.package-lock.json out of date, updated: node_modules
39 http fetch GET 200 https://registry.npmjs.org/bcrypt 282ms (cache revalidated)
40 silly placeDep ROOT [email protected] OK for: [email protected] want: *
41 silly fetch manifest node-addon-api@^5.0.0
42 http fetch GET 200 https://registry.npmjs.org/node-addon-api 65ms (cache revalidated)
43 timing idealTree:#root Completed in 363ms
44 silly placeDep ROOT [email protected] OK for: [email protected] want: ^5.0.0
45 timing idealTree:node_modules/bcrypt Completed in 6ms
46 timing idealTree:node_modules/node-addon-api Completed in 0ms
47 timing idealTree:buildDeps Completed in 370ms
48 timing idealTree:fixDepFlags Completed in 7ms
49 timing idealTree Completed in 453ms
50 timing reify:loadTrees Completed in 454ms
51 timing reify:diffTrees Completed in 8ms
52 silly reify moves {}
53 timing reify:retireShallow Completed in 1ms
54 timing reify:createSparse Completed in 2ms
55 timing reify:loadBundles Completed in 0ms
56 silly audit bulk request {
56 silly audit '@mapbox/node-pre-gyp': [ '1.0.11' ],
56 silly audit nopt: [ '5.0.0', '4.0.3', '1.0.10' ],
56 silly audit '@mongodb-js/saslprep': [ '1.1.4' ],
56 silly audit '@types/webidl-conversions': [ '7.0.3' ],
56 silly audit '@types/whatwg-url': [ '11.0.4' ],
56 silly audit abbrev: [ '1.1.1' ],
56 silly audit accepts: [ '1.3.8' ],
56 silly audit 'agent-base': [ '6.0.2' ],
56 silly audit debug: [ '4.3.4', '2.6.9', '3.2.7' ],
56 silly audit ms: [ '2.1.2', '2.1.3', '2.0.0' ],
56 silly audit 'ansi-regex': [ '5.0.1', '2.1.1' ],
56 silly audit anymatch: [ '3.1.3' ],
56 silly audit aproba: [ '2.0.0', '1.2.0' ],
56 silly audit 'are-we-there-yet': [ '2.0.0', '1.1.7' ],
56 silly audit 'array-flatten': [ '1.1.1' ],
56 silly audit 'balanced-match': [ '1.0.2' ],
56 silly audit 'binary-extensions': [ '2.2.0' ],
56 silly audit 'body-parser': [ '1.20.1' ],
56 silly audit 'brace-expansion': [ '1.1.11' ],
56 silly audit braces: [ '3.0.2' ],
56 silly audit bson: [ '6.2.0' ],
56 silly audit 'buffer-equal-constant-time': [ '1.0.1' ],
56 silly audit bytes: [ '3.1.2' ],
56 silly audit 'call-bind': [ '1.0.5' ],
56 silly audit chokidar: [ '3.5.3' ],
56 silly audit chownr: [ '2.0.0', '1.1.4' ],
56 silly audit 'code-point-at': [ '1.1.0' ],
56 silly audit 'color-support': [ '1.1.3' ],
56 silly audit 'concat-map': [ '0.0.1' ],
56 silly audit 'console-control-strings': [ '1.1.0' ],
56 silly audit 'content-disposition': [ '0.5.4' ],
56 silly audit 'content-type': [ '1.0.5' ],
56 silly audit cookie: [ '0.5.0' ],
56 silly audit 'cookie-signature': [ '1.0.6' ],
56 silly audit 'core-util-is': [ '1.0.3' ],
56 silly audit 'deep-extend': [ '0.6.0' ],
56 silly audit 'define-data-property': [ '1.1.1' ],
56 silly audit delegates: [ '1.0.0' ],
56 silly audit depd: [ '2.0.0' ],
56 silly audit destroy: [ '1.2.0' ],
56 silly audit 'detect-libc': [ '2.0.2', '1.0.3' ],
56 silly audit 'ecdsa-sig-formatter': [ '1.0.11' ],
56 silly audit 'ee-first': [ '1.1.1' ],
56 silly audit 'emoji-regex': [ '8.0.0' ],
56 silly audit encodeurl: [ '1.0.2' ],
56 silly audit 'escape-html': [ '1.0.3' ],
56 silly audit etag: [ '1.8.1' ],
56 silly audit express: [ '4.18.2' ],
56 silly audit 'express-validator': [ '7.0.1' ],
56 silly audit 'fill-range': [ '7.0.1' ],
56 silly audit finalhandler: [ '1.2.0' ],
56 silly audit forwarded: [ '0.2.0' ],
56 silly audit fresh: [ '0.5.2' ],
56 silly audit 'fs-minipass': [ '2.1.0', '1.2.7' ],
56 silly audit minipass: [ '3.3.6', '5.0.0', '2.9.0' ],
56 silly audit 'fs.realpath': [ '1.0.0' ],
56 silly audit fsevents: [ '2.3.3' ],
56 silly audit 'function-bind': [ '1.1.2' ],
56 silly audit gauge: [ '3.0.2', '2.7.4' ],
56 silly audit 'get-intrinsic': [ '1.2.2' ],
56 silly audit glob: [ '7.2.3' ],
56 silly audit 'glob-parent': [ '5.1.2' ],
56 silly audit gopd: [ '1.0.1' ],
56 silly audit 'has-flag': [ '3.0.0' ],
56 silly audit 'has-property-descriptors': [ '1.0.1' ],
56 silly audit 'has-proto': [ '1.0.1' ],
56 silly audit 'has-symbols': [ '1.0.3' ],
56 silly audit 'has-unicode': [ '2.0.1' ],
56 silly audit hasown: [ '2.0.0' ],
56 silly audit 'http-errors': [ '2.0.0' ],
56 silly audit 'https-proxy-agent': [ '5.0.1' ],
56 silly audit 'iconv-lite': [ '0.4.24' ],
56 silly audit 'ignore-by-default': [ '1.0.1' ],
56 silly audit 'ignore-walk': [ '3.0.4' ],
56 silly audit inflight: [ '1.0.6' ],
56 silly audit inherits: [ '2.0.4' ],
56 silly audit ini: [ '1.3.8' ],
56 silly audit install: [ '0.13.0' ],
56 silly audit 'ipaddr.js': [ '1.9.1' ],
56 silly audit 'is-binary-path': [ '2.1.0' ],
56 silly audit 'is-extglob': [ '2.1.1' ],
56 silly audit 'is-fullwidth-code-point': [ '3.0.0', '1.0.0' ],
56 silly audit 'is-glob': [ '4.0.3' ],
56 silly audit 'is-number': [ '7.0.0' ],
56 silly audit isarray: [ '1.0.0' ],
56 silly audit jsonwebtoken: [ '9.0.2' ],
56 silly audit jwa: [ '1.4.1' ],
56 silly audit jws: [ '3.2.2' ],
56 silly audit kareem: [ '2.5.1' ],
56 silly audit lodash: [ '4.17.21' ],
56 silly audit 'lodash.includes': [ '4.3.0' ],
56 silly audit 'lodash.isboolean': [ '3.0.3' ],
56 silly audit 'lodash.isinteger': [ '4.0.4' ],
56 silly audit 'lodash.isnumber': [ '3.0.3' ],
56 silly audit 'lodash.isplainobject': [ '4.0.6' ],
56 silly audit 'lodash.isstring': [ '4.0.1' ],
56 silly audit 'lodash.once': [ '4.1.1' ],
56 silly audit 'lru-cache': [ '6.0.0' ],
56 silly audit 'make-dir': [ '3.1.0' ],
56 silly audit semver: [ '6.3.1', '5.7.2', '7.5.4' ],
56 silly audit 'media-typer': [ '0.3.0' ],
56 silly audit 'memory-pager': [ '1.5.0' ],
56 silly audit 'merge-descriptors': [ '1.0.1' ],
56 silly audit methods: [ '1.1.2' ],
56 silly audit mime: [ '1.6.0' ],
56 silly audit 'mime-db': [ '1.52.0' ],
56 silly audit 'mime-types': [ '2.1.35' ],
56 silly audit minimatch: [ '3.1.2' ],
56 silly audit minimist: [ '1.2.8' ],
56 silly audit minizlib: [ '2.1.2', '1.3.3' ],
56 silly audit mkdirp: [ '1.0.4', '0.5.6' ],
56 silly audit mongodb: [ '6.3.0' ],
56 silly audit 'mongodb-connection-string-url': [ '3.0.0' ],
56 silly audit mongoose: [ '8.1.1' ],
56 silly audit mpath: [ '0.9.0' ],
56 silly audit mquery: [ '5.0.0' ],
56 silly audit needle: [ '2.9.1' ],
56 silly audit negotiator: [ '0.6.3' ],
56 silly audit 'node-fetch': [ '2.7.0' ],
56 silly audit tr46: [ '0.0.3', '4.1.1' ],
56 silly audit 'webidl-conversions': [ '3.0.1', '7.0.0' ],
56 silly audit mongoose: [ '8.1.1' ],
56 silly audit mpath: [ '0.9.0' ],
56 silly audit mquery: [ '5.0.0' ],
56 silly audit needle: [ '2.9.1' ],
56 silly audit negotiator: [ '0.6.3' ],
56 silly audit 'node-fetch': [ '2.7.0' ],
56 silly audit tr46: [ '0.0.3', '4.1.1' ],
56 silly audit 'webidl-conversions': [ '3.0.1', '7.0.0' ],
56 silly audit 'whatwg-url': [ '5.0.0', '13.0.0' ],
56 silly audit 'node-pre-gyp': [ '0.17.0' ],
56 silly audit npmlog: [ '4.1.2', '5.0.1' ],
56 silly audit 'readable-stream': [ '2.3.8', '3.6.2' ],
56 silly audit 'safe-buffer': [ '5.1.2', '5.2.1' ],
56 silly audit rimraf: [ '2.7.1', '3.0.2' ],
56 silly audit string_decoder: [ '1.1.1', '1.3.0' ],
56 silly audit 'string-width': [ '1.0.2', '4.2.3' ],
56 silly audit 'strip-ansi': [ '3.0.1', '6.0.1' ],
56 silly audit tar: [ '4.4.19', '6.2.0' ],
56 silly audit yallist: [ '3.1.1', '4.0.0' ],
56 silly audit nodemon: [ '3.0.3' ],
56 silly audit 'normalize-path': [ '3.0.0' ],
56 silly audit 'npm-bundled': [ '1.1.2' ],
56 silly audit 'npm-normalize-package-bin': [ '1.0.1' ],
56 silly audit 'npm-packlist': [ '1.4.8' ],
56 silly audit 'number-is-nan': [ '1.0.1' ],
56 silly audit 'object-assign': [ '4.1.1' ],
56 silly audit 'object-inspect': [ '1.13.1' ],
56 silly audit 'on-finished': [ '2.4.1' ],
56 silly audit once: [ '1.4.0' ],
56 silly audit 'os-homedir': [ '1.0.2' ],
56 silly audit 'os-tmpdir': [ '1.0.2' ],
56 silly audit osenv: [ '0.1.5' ],
56 silly audit parseurl: [ '1.3.3' ],
56 silly audit 'path-is-absolute': [ '1.0.1' ],
56 silly audit 'path-to-regexp': [ '0.1.7' ],
56 silly audit picomatch: [ '2.3.1' ],
56 silly audit 'process-nextick-args': [ '2.0.1' ],
56 silly audit 'proxy-addr': [ '2.0.7' ],
56 silly audit 'pstree.remy': [ '1.1.8' ],
56 silly audit punycode: [ '2.3.1' ],
56 silly audit qs: [ '6.11.0' ],
56 silly audit 'range-parser': [ '1.2.1' ],
56 silly audit 'raw-body': [ '2.5.1' ],
56 silly audit rc: [ '1.2.8' ],
56 silly audit readdirp: [ '3.6.0' ],
56 silly audit 'safer-buffer': [ '2.1.2' ],
56 silly audit sax: [ '1.3.0' ],
56 silly audit send: [ '0.18.0' ],
56 silly audit 'serve-static': [ '1.15.0' ],
56 silly audit 'set-blocking': [ '2.0.0' ],
56 silly audit 'set-function-length': [ '1.2.0' ],
56 silly audit setprototypeof: [ '1.2.0' ],
56 silly audit 'side-channel': [ '1.0.4' ],
56 silly audit sift: [ '16.0.1' ],
56 silly audit 'signal-exit': [ '3.0.7' ],
56 silly audit 'simple-update-notifier': [ '2.0.0' ],
56 silly audit 'sparse-bitfield': [ '3.0.3' ],
56 silly audit statuses: [ '2.0.1' ],
56 silly audit 'strip-json-comments': [ '2.0.1' ],
56 silly audit 'supports-color': [ '5.5.0' ],
56 silly audit 'to-regex-range': [ '5.0.1' ],
56 silly audit toidentifier: [ '1.0.1' ],
56 silly audit touch: [ '3.1.0' ],
56 silly audit 'type-is': [ '1.6.18' ],
56 silly audit undefsafe: [ '2.0.5' ],
56 silly audit unpipe: [ '1.0.0' ],
56 silly audit 'util-deprecate': [ '1.0.2' ],
56 silly audit 'utils-merge': [ '1.0.1' ],
56 silly audit validator: [ '13.11.0' ],
56 silly audit vary: [ '1.1.2' ],
56 silly audit 'wide-align': [ '1.1.5' ],
56 silly audit wrappy: [ '1.0.2' ],
56 silly audit bcrypt: [ '5.1.1' ],
56 silly audit 'node-addon-api': [ '5.1.0' ]
56 silly audit }
57 verbose reify failed optional dependency /home/animagnoa/git/learn-reactjs-nodejs/node_modules/fsevents
58 silly reify mark deleted [ '/home/animagnoa/git/learn-reactjs-nodejs/node_modules/fsevents' ]
59 timing reifyNode:node_modules/fsevents Completed in 4ms
60 timing reifyNode:node_modules/node-addon-api Completed in 23ms
61 timing reifyNode:node_modules/bcrypt Completed in 23ms
62 timing reify:unpack Completed in 23ms
63 timing reify:unretire Completed in 0ms
64 timing build:queue Completed in 0ms
65 info run [email protected] install node_modules/bcrypt node-pre-gyp install --fallback-to-build
66 info run [email protected] install { code: 7, signal: null }
67 timing reify:rollback:createSparse Completed in 2ms
68 timing reify:rollback:retireShallow Completed in 0ms
69 timing command:install Completed in 639ms
70 verbose stack Error: command failed
70 verbose stack at ChildProcess.<anonymous> (/snap/node/8169/lib/node_modules/npm/node_modules/@npmcli/promise-spawn/lib/index.js:53:27)
70 verbose stack at ChildProcess.emit (node:events:518:28)
70 verbose stack at maybeClose (node:internal/child_process:1105:16)
70 verbose stack at ChildProcess._handle.onexit (node:internal/child_process:305:5)
71 verbose pkgid [email protected]
72 verbose cwd /home/animagnoa/git/learn-reactjs-nodejs
73 verbose Linux 5.15.0-92-generic
74 verbose node v20.11.0
75 verbose npm v10.2.4
76 error code 7
77 error path /home/animagnoa/git/learn-reactjs-nodejs/node_modules/bcrypt
78 error command failed
79 error command sh -c node-pre-gyp install --fallback-to-build
80 verbose exit 7
81 timing npm Completed in 766ms
82 verbose unfinished npm timer reify 1707053178647
83 verbose unfinished npm timer reify:audit 1707053179118
84 verbose unfinished npm timer auditReport:getReport 1707053179119
85 verbose unfinished npm timer reify:build 1707053179149
86 verbose unfinished npm timer build 1707053179150
87 verbose unfinished npm timer build:deps 1707053179150
88 verbose unfinished npm timer build:run:install 1707053179150
89 verbose unfinished npm timer build:run:install:node_modules/bcrypt 1707053179151
90 verbose code 7
91 error A complete log of this run can be found in: /home/animagnoa/.npm/_logs/2024-02-04T13_26_18_519Z-debug-0.log
还安装了:Python 3.10.12、g++ 11.4.0、GNU Make 4.3
尝试安装不同版本的依赖项,但这对我来说似乎不是问题。
解决方案:
sudo npm cache clean -f
sudo n stable
npm i bcrypt