解决办法:npm ERR! code ENOLOCK

Posted 柳鲲鹏

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了解决办法:npm ERR! code ENOLOCK相关的知识,希望对你有一定的参考价值。

具体错误

$ sudo npm audit fix --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!     /home/tsit/.npm/_logs/2022-12-13T07_12_26_971Z-debug-0.log
  • 初始化
$ sudo npm init --yes

Wrote to /home/tsit/package.json:


  "name": "tsit",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "directories": 
    "test": "test"
  ,
  "scripts": 
    "test": "echo \\"Error: no test specified\\" && exit 1"
  ,
  "keywords": [],
  "author": "",
  "license": "ISC"


  • 创建package-lock-only

$ sudo npm i --package-lock-only

up to date, audited 1 package in 114ms

found 0 vulnerabilities
  • 自动修复

$ sudo npm audit fix --force
npm WARN using --force Recommended protections disabled.

up to date, audited 1 package in 98ms

found 0 vulnerabilities
  • 验证

执行相应命令。比如我安装的是syberh:

$ syberh -version
2.2.4

以上是关于解决办法:npm ERR! code ENOLOCK的主要内容,如果未能解决你的问题,请参考以下文章

npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree

npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! test_vue_0613@1.0.0 dev: 错误的解决方法

npm install 报错:ERR! code EINTEGRITY 解决方案

npm ERR! code EINTEGRITY 安装taro报错解决方案

问题解决npm ERR! code EINTEGRITY

npm 安装报错 “npm ERR! code Z_BUF_ERROR“ 解决方法