解决办法: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
目录
相关文章
|
8月前
|
网络安全 计算机视觉
【node】 npm install 报错:code 128
【node】 npm install 报错:code 128
232 1
|
8月前
|
缓存
npm install 报 npm ERR! cb()never called!的错误
npm install 报 npm ERR! cb()never called!的错误
1305 0
|
18天前
|
JavaScript
nodejs安装之npm ERR! code CERT_HAS_EXPIREDnpm ERR! errno CERT_HAS_EXPIRED reason: certificate has expired-证书错误通用问题解决方案-优雅草央千澈
nodejs安装之npm ERR! code CERT_HAS_EXPIREDnpm ERR! errno CERT_HAS_EXPIRED reason: certificate has expired-证书错误通用问题解决方案-优雅草央千澈
|
5月前
|
缓存
成功解决: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`文件,然后重新尝试安装,以解决版本冲突问题。
|
5月前
|
缓存
Node——npm ERR! cb() never called!
Node——npm ERR! cb() never called!
88 0
|
7月前
npm ERR! code ERESOLVEnpm ERR! ERESOLVE could not resolvenpm ERR!-解决
npm ERR! code ERESOLVEnpm ERR! ERESOLVE could not resolvenpm ERR!-解决
|
8月前
使用npm install时遇到问题:npm ERR! code ERESOLVE
使用npm install时遇到问题:npm ERR! code ERESOLVE
228 1
|
8月前
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
252 0
|
8月前
|
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!
|
19天前
|
JavaScript
node环境之Error: Cannot find module ‘chalk’ 报错无法解决的问题—-网上说让你npm install chalk 基本是没有用的-优雅草央千澈解决方案
node环境之Error: Cannot find module ‘chalk’ 报错无法解决的问题—-网上说让你npm install chalk 基本是没有用的-优雅草央千澈解决方案
node环境之Error: Cannot find module ‘chalk’ 报错无法解决的问题—-网上说让你npm install chalk 基本是没有用的-优雅草央千澈解决方案

热门文章

最新文章

推荐镜像

更多