'Getting : npm WARN using --force Recommended protections disabled
I have an old Nuxt.js package that was developed in Node 12 and I want to use it now with Node 16 (the latest stable) but when I try to install my packages by npm install
I'm getting the versions difference errors.
But I know the packages are up to date. So, I'm trying to force clear my npm cache by sudo npm cache clean -f
but I'm getting this error:
npm WARN using --force Recommended protections disabled.
The environment is ubuntu 20.04
and this is my package.json
file:
{
"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"
}
}
How can I use the force flag without getting errors?
Edit:
Solution 1:[1]
So i was having the same problem as you and I thought that the caching didn't work but in reality it worked it was just a warning message try this command npm cache verify
to verify if the caching worked or not and if it worked your problem is not with the caching but the problem is probably with your node version.
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>
Solution 2:[2]
It seems to be an issue with the current version of Node installed on your device. If you try to reinstall on top of the previous installation, or use the @latest command it won't work. Please uninstall Node then reinstall again from the offical website.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | AmineTech |
Solution 2 | kissu |