解决办法:npm ERR! code ENOLOCK

简介: 解决办法: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
目录
相关文章
|
6月前
|
网络安全 计算机视觉
【node】 npm install 报错:code 128
【node】 npm install 报错:code 128
189 1
|
6月前
|
缓存 资源调度
解决安装依赖时报错:npm ERR! code ERESOLVE
解决安装依赖时报错:npm ERR! code ERESOLVE
3102 0
解决安装依赖时报错:npm ERR! code ERESOLVE
|
6月前
|
缓存
npm install 报 npm ERR! cb()never called!的错误
npm install 报 npm ERR! cb()never called!的错误
929 0
|
3月前
|
缓存
成功解决:Could not resolve dependency: npm ERR! peer vue@“^3.0.2“ from vuex@4.0.2
这篇文章讨论了在使用npm安装依赖时遇到的一个常见问题,即无法解析依赖导致的"peer dependency"冲突错误。文章提供了几种解决方法,包括清除npm缓存、删除`node_modules`文件夹和`package-lock.json`文件,然后重新尝试安装,以解决版本冲突问题。
|
3月前
|
缓存
Node——npm ERR! cb() never called!
Node——npm ERR! cb() never called!
58 0
|
5月前
npm ERR! code ERESOLVEnpm ERR! ERESOLVE could not resolvenpm ERR!-解决
npm ERR! code ERESOLVEnpm ERR! ERESOLVE could not resolvenpm ERR!-解决
|
6月前
使用npm install时遇到问题:npm ERR! code ERESOLVE
使用npm install时遇到问题:npm ERR! code ERESOLVE
108 1
|
6月前
npm报错:npm ERR! code ECONNREFUSED npm ERR! errno ECONNREFUSED,npm ERR! npm ERR! If you are behind a
npm报错:npm ERR! code ECONNREFUSED npm ERR! errno ECONNREFUSED,npm ERR! npm ERR! If you are behind a
107 0
|
6月前
|
JavaScript 网络安全 数据安全/隐私保护
【问题:创建Vue项目】npm ERR! code CERT_HAS_EXPIRED npm ERR! errno CERT_HAS_EXPIRED npm ERR!
【问题:创建Vue项目】npm ERR! code CERT_HAS_EXPIRED npm ERR! errno CERT_HAS_EXPIRED npm ERR!
|
30天前
|
缓存 资源调度 JavaScript
npx与npm的差异解析,以及包管理器yarn与Node版本管理工具nvm的使用方法详解
npx与npm的差异解析,以及包管理器yarn与Node版本管理工具nvm的使用方法详解
31 0