获取:npm WARN 使用 --force 建议的保护已禁用
Getting : npm WARN using --force Recommended protections disabled
我有一个在 Node 12 中开发的旧 Nuxt.js 包,我现在想将它与 Node 16(最新稳定版)一起使用,但是当我尝试通过 npm install
安装我的包时我收到版本差异错误。
但我知道软件包是最新的。所以,我试图通过 sudo npm cache clean -f
强制清除我的 npm 缓存,但我收到此错误:
npm WARN using --force Recommended protections disabled.
环境是ubuntu 20.04
,这是我的package.json
文件:
{
"name": "frontend",
"version": "1.0.0",
"private": true,
"scripts": {
"dev": "nuxt",
"build": "nuxt build",
"start": "nuxt start",
"generate": "nuxt generate"
},
"dependencies": {
"@nuxtjs/auth": "^4.9.1",
"@nuxtjs/axios": "^5.13.6",
"@nuxtjs/dotenv": "^1.4.1",
"@nuxtjs/google-adsense": "^1.4.0",
"@nuxtjs/gtm": "^2.4.0",
"@nuxtjs/router": "^1.6.1",
"better-vue-input-tag": "^1.1.0",
"bootstrap": "^5.1.3",
"bootstrap-vue": "^2.21.2",
"core-js": "^3.19.2",
"eslint": "^8.3.0",
"jquery": "^3.6.0",
"laravel-vue-pagination": "^2.3.1",
"node-sass": "^6.0.1",
"nuxt": "^2.15.8",
"popper.js": "^1.16.1",
"sass-loader": "^12.3.0",
"vform": "^2.1.2",
"vue-autosuggest": "^2.2.0",
"vue-gtag": "^1.16.1",
"vue-infinite-loading": "^2.4.5",
"vue2-google-maps-withscopedautocomp": "^0.12.1"
},
"devDependencies": {
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^4.0.0",
"ip": "^1.1.5",
"prettier": "^2.5.0"
}
}
如何在不出错的情况下使用强制标志?
编辑:
我因版本差异而收到的错误:
您设备上当前安装的 Node 版本似乎有问题。如果您尝试在先前安装的基础上重新安装,或使用 @latest 命令,它将不起作用。请卸载 Node,然后从官方网站重新安装。
所以我遇到了和你一样的问题,我认为缓存不起作用,但实际上它起作用了,这只是一条警告消息尝试这个命令 npm cache verify
来验证缓存是否起作用或者不是,如果它有效,你的问题不在于缓存,但问题可能在于你的节点版本。
PS C:\code> npm cache clean --force
npm WARN using --force Recommended protections disabled.
PS C:\code> npm cache verify
Cache verified and compressed (~\AppData\Local\npm-cache\_cacache)
Content verified: 0 (0 bytes)
Index entries: 0
Finished in 0.008s
PS C:\code>
我有一个在 Node 12 中开发的旧 Nuxt.js 包,我现在想将它与 Node 16(最新稳定版)一起使用,但是当我尝试通过 npm install
安装我的包时我收到版本差异错误。
但我知道软件包是最新的。所以,我试图通过 sudo npm cache clean -f
强制清除我的 npm 缓存,但我收到此错误:
npm WARN using --force Recommended protections disabled.
环境是ubuntu 20.04
,这是我的package.json
文件:
{
"name": "frontend",
"version": "1.0.0",
"private": true,
"scripts": {
"dev": "nuxt",
"build": "nuxt build",
"start": "nuxt start",
"generate": "nuxt generate"
},
"dependencies": {
"@nuxtjs/auth": "^4.9.1",
"@nuxtjs/axios": "^5.13.6",
"@nuxtjs/dotenv": "^1.4.1",
"@nuxtjs/google-adsense": "^1.4.0",
"@nuxtjs/gtm": "^2.4.0",
"@nuxtjs/router": "^1.6.1",
"better-vue-input-tag": "^1.1.0",
"bootstrap": "^5.1.3",
"bootstrap-vue": "^2.21.2",
"core-js": "^3.19.2",
"eslint": "^8.3.0",
"jquery": "^3.6.0",
"laravel-vue-pagination": "^2.3.1",
"node-sass": "^6.0.1",
"nuxt": "^2.15.8",
"popper.js": "^1.16.1",
"sass-loader": "^12.3.0",
"vform": "^2.1.2",
"vue-autosuggest": "^2.2.0",
"vue-gtag": "^1.16.1",
"vue-infinite-loading": "^2.4.5",
"vue2-google-maps-withscopedautocomp": "^0.12.1"
},
"devDependencies": {
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^4.0.0",
"ip": "^1.1.5",
"prettier": "^2.5.0"
}
}
如何在不出错的情况下使用强制标志?
编辑:
我因版本差异而收到的错误:
您设备上当前安装的 Node 版本似乎有问题。如果您尝试在先前安装的基础上重新安装,或使用 @latest 命令,它将不起作用。请卸载 Node,然后从官方网站重新安装。
所以我遇到了和你一样的问题,我认为缓存不起作用,但实际上它起作用了,这只是一条警告消息尝试这个命令 npm cache verify
来验证缓存是否起作用或者不是,如果它有效,你的问题不在于缓存,但问题可能在于你的节点版本。
PS C:\code> npm cache clean --force
npm WARN using --force Recommended protections disabled.
PS C:\code> npm cache verify
Cache verified and compressed (~\AppData\Local\npm-cache\_cacache)
Content verified: 0 (0 bytes)
Index entries: 0
Finished in 0.008s
PS C:\code>