Home > Mobile >  type 'npm install -g @vue/cli', npm show WARN and ERR
type 'npm install -g @vue/cli', npm show WARN and ERR

Time:01-01

When I type 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.

But more WARN message but stackoverflow think it's spam. appears. So, I did npm audit fix --force. And the terminal show this:

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\_logs\2022-12-31T23_04_36_391Z-debug-0.log       

up to date, audited 1 package in 640ms

found 0 vulnerabilities

and C:\Users\user\AppData\Local\npm-cache\_logs\2022-12-31T23_04_36_391Z-debug-0.log log file is this:

0 verbose cli D:\nodejs\node.exe D:\nodejs\node_modules\npm\bin\npm-cli.js
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 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\_logs\2022-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\_logs\2022-12-31T23_04_36_391Z-debug-0.log

Is this a normal installation? Is it an abnormal installation?

There seems to be a problem because there are a lot of ERR! letters. help.

CodePudding user response:

Like the error output is telling you, you have to run the command npm i --package-lock-only.

Also see What does 'npm i --package-lock-only' do?

CodePudding user response:

I think it should work

You execute this command. Install the package from yarn

yarn global add @vue/cli

and You can check you have the right version with this command:

vue --version
  • Related