Baroshem / nuxt-security

🛡 Automatically configure your app to follow OWASP security patterns and principles by using HTTP Headers and Middleware
https://nuxt-security.vercel.app/
MIT License
816 stars 56 forks source link

Could not resolve import "cheerio/lib/slim" #514

Closed igorgusarov closed 1 month ago

igorgusarov commented 2 months ago

Version

nuxt-security: 1.4.3 nuxt: 3.13.0

Issue

After updating Nuxt to 3.13.0, nuxt-security triggers a bunch of errors: [plugin node-resolve] Could not resolve import "cheerio/lib/slim" in /my/app/path/node_modules/.pnpm/nuxt-security@1.4.3_magicast@0.3.4_rollup@4.21.0/node_modules/nuxt-security/dist/runtime/nitro/plugins/40-preprocessHtml.mjs using exports defined in /Users/igor/Sites/platform/apps/console/web/node_modules/.pnpm/cheerio@1.0.0/node_modules/cheerio/package.json.

Cheerio recently got updated to 1.0.0, and this update includes changing paths from cheerio/lib/slim to cheerio/slim: https://github.com/cheeriojs/cheerio/releases/tag/v1.0.0

Amar-Gill commented 2 months ago

In the mean time I am using a package override in my package.json file to get around this.

I've added the following:

// package.json
  "pnpm": {
    "overrides": {
      "nuxt-security>cheerio": "1.0.0-rc.12"
    }
  }

source

miclgael commented 2 months ago

Thanks so much @Amar-Gill for providing the work around. 🙏

Harm-Nullix commented 2 months ago

How dumb that v1.0.0 crashes xD, just after the canidate is accepted..!?

Oh well.. been there..

package.json workaround:

  "resolutions": {
    "cheerio": "1.0.0-rc.12"
  }

If this is not working, try rm -rf node_modules && rm -f yarn.lock or something

Baroshem commented 2 months ago

Hey folks, thanks for providing a solution. I was away for a long holidays and couldn't respond.

Cheerio is completely removed in the upcoming 2.0.0 version so the issues should be resolved once we will release a new version :)

Harm-Nullix commented 1 month ago

Awesome!

Hope you had a good holiday! Good job of not looking at your mail / git 💯

Baroshem commented 1 month ago

Released in 2.0.0 :)