当我输入 npm install -g @vue/cli
时,
changed 851 packages, and audited 852 packages in 2m 64 packages are looking for funding 4 vulnerabilities (2 moderate, 2 high) To address all issues (including breaking changes), run: npm audit fix --force Run `npm audit` for details.
但是有更多 WARN 消息,但 stackoverflow 认为它是垃圾邮件。
出现。所以,我做了 npm 审核修复 --force
。终端显示:
npm WARN using --force Recommended protections disabled. npm ERR! code ENOLOCK npm ERR! audit This command requires an existing lockfile. npm ERR! audit Try creating one first with: npm i --package-lock-only npm ERR! audit Original error: loadVirtual requires existing shrinkwrap file npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\user\AppData\Local\npm-cache\_logs22-12-31T23_04_36_391Z-debug-0.log up to date, audited 1 package in 640ms found 0 vulnerabilities
和 C:\Users\user\AppData\Local\npm-cache\_logs\2022-12-31T23_04_36_391Z-debug-0.log
日志文件是这样的:
0 verbose cli D:\nodejs\node.exe D:\nodejs\node_modules\npm\bin\npm-cli.js 1 info using npm@8.19.2 2 info using node@v18.12.1 3 timing npm:load:whichnode Completed in 1ms 4 timing config:load:defaults Completed in 3ms 5 timing config:load:file:D:\nodejs\node_modules\npm\npmrc Completed in 14ms 6 timing config:load:builtin Completed in 16ms 7 timing config:load:cli Completed in 3ms 8 timing config:load:env Completed in 1ms 9 timing config:load:file:D:\node-project\.npmrc Completed in 1ms 10 timing config:load:project Completed in 2ms 11 timing config:load:file:C:\Users\user\.npmrc Completed in 0ms 12 timing config:load:user Completed in 1ms 13 timing config:load:file:C:\Users\user\AppData\Roaming\npm\etc\npmrc Completed in 0ms 14 timing config:load:global Completed in 0ms 15 timing config:load:validate Completed in 0ms 16 timing config:load:credentials Completed in 1ms 17 timing config:load:setEnvs Completed in 2ms 18 timing config:load Completed in 31ms 19 timing npm:load:configload Completed in 31ms 20 timing npm:load:mkdirpcache Completed in 2ms 21 timing npm:load:mkdirplogs Completed in 1ms 22 verbose title npm audit fix 23 verbose argv "audit" "fix" "--force" 24 timing npm:load:setTitle Completed in 2ms 25 timing config:load:flatten Completed in 7ms 26 timing npm:load:display Completed in 11ms 27 verbose logfile logs-max:10 dir:C:\Users\user\AppData\Local\npm-cache\_logs 28 verbose logfile C:\Users\user\AppData\Local\npm-cache\_logs22-12-31T23_04_36_391Z-debug-0.log 29 timing npm:load:logFile Completed in 14ms 30 timing npm:load:timers Completed in 1ms 31 timing npm:load:configScope Completed in 0ms 32 warn using --force Recommended protections disabled. 33 timing npm:load Completed in 68ms 34 timing arborist:ctor Completed in 1ms 35 silly logfile start cleaning logs, removing 2 files 36 timing command:audit Completed in 29ms 37 verbose stack Error: loadVirtual requires existing shrinkwrap file 37 verbose stack at Arborist.loadVirtual (D:\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\load-virtual.js:63:18) 37 verbose stack at async Arborist.audit (D:\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\audit.js:25:18) 37 verbose stack at async Audit.auditAdvisories (D:\nodejs\node_modules\npm\lib\commands\audit.js:390:5) 37 verbose stack at async Audit.exec (D:\nodejs\node_modules\npm\lib\commands\audit.js:374:7) 37 verbose stack at async module.exports (D:\nodejs\node_modules\npm\lib\cli.js:78:5) 38 verbose cwd D:\node-project 39 verbose Windows_NT 10.0.19044 40 verbose node v18.12.1 41 verbose npm v8.19.2 42 error code ENOLOCK 43 error audit This command requires an existing lockfile. 44 error audit Try creating one first with: npm i --package-lock-only 45 error audit Original error: loadVirtual requires existing shrinkwrap file 46 verbose exit 1 47 timing npm Completed in 403ms 48 verbose unfinished npm timer audit 1672527876747 49 verbose code 1 50 error A complete log of this run can be found in: 50 error C:\Users\user\AppData\Local\npm-cache\_logs22-12-31T23_04_36_391Z-debug-0.log
这是正常安装吗?是否是安装异常?
似乎有问题,因为有很多 ERR!字母。帮助。
我认为应该有效
您执行此命令。从yarn安装包
您可以使用以下命令检查您是否拥有正确的版本:
就像错误输出告诉您的那样,您必须运行命令
npm i --package-lock-only
。另请参阅 'npm i --package-lock-只做?