Getting : npm WARN using –force Recommended protections disabled

Total
0
Shares

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:

The errors that I’m getting for versions difference:
enter image description here


Solution

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 (~AppDataLocalnpm-cache_cacache)
Content verified: 0 (0 bytes)
Index entries: 0
Finished in 0.008s
PS C:code>

Source: StackOverflow.com

Leave a Reply

Your email address will not be published. Required fields are marked *