icon icon indicating copy to clipboard operation
icon copied to clipboard

[BUG] Deprecation Warning on Nuxt.js build due to package.json export

Open danperks opened this issue 1 year ago • 36 comments

When building my Nuxt.js project which uses this package, I get a bunch of deprecation warnings, following this format:

(node:2848) [DEP0166] DeprecationWarning: Use of deprecated double slash resolving ".//index.json" for module request ".//index.json" matched to "./*" in the "exports" field module resolution of the package at [PROJECT PATH]\node_modules\@iconify\vue\package.json imported from [PROJECT PATH]\node_modules\nitropack\node_modules\_index.js.
(node:2848) [DEP0166] DeprecationWarning: Use of deprecated double slash resolving ".//index.mjs" for module request ".//index.mjs" matched to "./*" in the "exports" field module resolution of the package at [PROJECT PATH]\node_modules\@iconify\vue\package.json imported from [PROJECT PATH]\node_modules\nitropack\node_modules.
(node:2848) [DEP0166] DeprecationWarning: Use of deprecated double slash resolving ".//index.cjs" for module request ".//index.cjs" matched to "./*" in the "exports" field module resolution of the package at [PROJECT PATH]\node_modules\@iconify\vue\package.json imported from [PROJECT PATH]\node_modules\nitropack\node_modules.
(node:2848) [DEP0166] DeprecationWarning: Use of deprecated double slash resolving ".//index.js" for module request ".//index.js" matched to "./*" in the "exports" field module resolution of the package at [PROJECT PATH]\node_modules\@iconify\vue\package.json imported from [PROJECT PATH]\node_modules\nitropack\node_modules.
(node:2848) [DEP0166] DeprecationWarning: Use of deprecated double slash resolving ".//index.json" for module request ".//index.json" matched to "./*" in the "exports" field module resolution of the package at [PROJECT PATH]\node_modules\@iconify\vue\package.json imported from [PROJECT PATH]\node_modules\nitropack\node_modules.
(node:2848) [DEP0166] DeprecationWarning: Use of deprecated double slash resolving ".//index.mjs" for module request ".//index.mjs" matched to "./*" in the "exports" field module resolution of the package at [PROJECT PATH]\node_modules\@iconify\vue\package.json imported from [PROJECT PATH]\node_modules.
(node:2848) [DEP0166] DeprecationWarning: Use of deprecated double slash resolving ".//index.cjs" for module request ".//index.cjs" matched to "./*" in the "exports" field module resolution of the package at [PROJECT PATH]\node_modules\@iconify\vue\package.json imported from [PROJECT PATH]\node_modules.
(node:2848) [DEP0166] DeprecationWarning: Use of deprecated double slash resolving ".//index.js" for module request ".//index.js" matched to "./*" in the "exports" field module resolution of the package at [PROJECT PATH]\node_modules\@iconify\vue\package.json imported from [PROJECT PATH]\node_modules.
(node:2848) [DEP0166] DeprecationWarning: Use of deprecated double slash resolving ".//index.json" for module request ".//index.json" matched to "./*" in the "exports" field module resolution of the package at [PROJECT PATH]\node_modules\@iconify\vue\package.json imported from [PROJECT PATH]\node_modules.
(node:2848) [DEP0166] DeprecationWarning: Use of deprecated double slash resolving ".//index.mjs" for module request ".//index.mjs" matched to "./*" in the "exports" field module resolution of the package at [PROJECT PATH]\node_modules\@iconify\vue\package.json imported from [PROJECT PATH]\node_modules\nuxt\node_modules.

This looks to be referring to this line in the Iconify package.json:

https://github.com/iconify/iconify/blob/a8e3b45ecd56e194fd8ef2c3b4eeb6f8c4e68bb1/components/vue/package.json#L27

Have I got a configuration issue, or is this a bug in this library or the Iconify one? Haven't found any previous reports of this, so this could just be an issue with my project.

I'm on Node v18.17.0, Nuxt v3.8.0 and NuxtIcon v0.6.1 Thanks :)

danperks avatar Feb 07 '24 18:02 danperks

I have the same problem

Node v20.1 Nuxt V3.10.2 Nuxt-Icon v0.6.8

image

This looks to be referring to this line in the Iconify package.json:

https://github.com/iconify/iconify/blob/a8e3b45ecd56e194fd8ef2c3b4eeb6f8c4e68bb1/components/vue/package.json#L27

I tried removing the line specified in the above link and the error disappeared.

I'm executing pnpm build

hmingv avatar Feb 22 '24 07:02 hmingv

I've seen this issue in another project after recent update when import path ends with /

Maybe there is import somewhere in code that ends with /, like tries to import from @iconify/vue/? I can't find such code.

cyberalien avatar Feb 22 '24 07:02 cyberalien

Since I couldn't determine the source of the problem, I used the stupidest way to test (deleting files one by one, you need to delete node_modules at the same time and repackage)

When I encountered the .npmrc file, I removed the shamefully-hoist=true line and the problem was solved.

I'm not sure if there's any connection, but it does solve my problem for now

hmingv avatar Feb 23 '24 02:02 hmingv

I also have this in my project

Running node 20.11.0 nuxt 3.8.2 nuxt-icon 0.6.8

KarelVendla avatar Feb 26 '24 15:02 KarelVendla

After my investigation, nuxt starter will write a .npmrc file before September 2023 that includes shamefull-hoist=true. This will cause an issue when running pnpm build. However, this file has been removed as of September 2023. Therefore, if the project was created before, it may still have this file.

No longer see this warning after manually removing the file.

Reference https://github.com/nuxt/starter/commit/9afba5de755de04965938027a3321a4980b31404

@hmingv Thank you for your helpful response, it saved me from being stuck here like you.

ausir0726 avatar Mar 28 '24 08:03 ausir0726

@hmingv I removed the shamefully-hoist=true line and the problem still exists;

lx-elephantxiang avatar Apr 17 '24 10:04 lx-elephantxiang

Are you encountering guys right after you push ur updates in production, the nuxt application will be delayed for a bit of seconds in every page that I navigate? when I already went there on every page, it will become normal navigation again, there's no delay. Is there any connections about this warning or issue of @iconify/vue/ ? btw I deployed my nuxt app using npm run build for ssr in vercel. TIA

Kram-V avatar Apr 23 '24 09:04 Kram-V

same here, after upgrading Nuxt from 3.9.3 to 3.11.2

image

kleinpetr avatar Apr 30 '24 09:04 kleinpetr

@kleinpetr can we downgrade the nuxt app?

Kram-V avatar Apr 30 '24 09:04 Kram-V

@Kram-V yes, when I downgrade to 3.9.3 the build has no issue

kleinpetr avatar Apr 30 '24 09:04 kleinpetr

@kleinpetr ok tnx

Kram-V avatar Apr 30 '24 10:04 Kram-V

@Kram-V oh sorry, it seems that I am getting these warning also with locked 3.9.3 :thinking: so in my case it's because I removed pnpm.lock after a while, so some deps was cached probably, so cannot specifically...

kleinpetr avatar Apr 30 '24 10:04 kleinpetr

@Kram-V oh sorry, it seems that I am getting these warning also with locked 3.9.3 🤔 so in my case it's because I removed pnpm.lock after a while, so some deps was cached probably, so cannot specifically...

Try running pnpm dedupe

cyberalien avatar Apr 30 '24 10:04 cyberalien

btw @kleinpetr how can you downgrade ur nuxt app with specific version?

Kram-V avatar Apr 30 '24 10:04 Kram-V

@kleinpetr I removed the node_modules and package-lock.json and change the version of my nuxt app into ^3.9.3 but when I npm run dev the pop up in the terminal still Nuxt 3.11.2 why is that?

Kram-V avatar Apr 30 '24 10:04 Kram-V

Remove ^ from version number

cyberalien avatar Apr 30 '24 10:04 cyberalien

@cyberalien ok sir I will try

Kram-V avatar Apr 30 '24 10:04 Kram-V

@cyberalien it worked, thank you so much sir!

Kram-V avatar Apr 30 '24 10:04 Kram-V

Same here. Don't know when this started as I don't watch the whole build process.

These didn't work:

  • Deleting node_modules and lock file and .nuxt
  • Downgrading to nuxt 3.9.3
  • Removing shamefully-hoist=true
  • Using npm or yarn

Sharing my info just in case it helps with the debugging.

node: v20.11.1 pnpm: 8.15.4

Errors(getting like 500 errors like this on pnpm build, not just for iconify but for almost all the packages):

(node:20280) [DEP0166] DeprecationWarning: Use of deprecated double slash resolving ".//index.json" for module request ".//index.json" matched to "./*" in the "exports" field module resolution of the package at C:\CODING STUFF\PROJECTS\bulut-search\frontend\node_modules\@iconify\vue\package.json imported from C:\CODING STUFF\PROJECTS\bul-search\frontend\node_modules\.pnpm\[email protected]\node_modules\_index.js.
(node:20280) [DEP0166] DeprecationWarning: Use of deprecated double slash resolving ".//index.mjs" for module request ".//index.mjs" matched to "./*" in the "exports" field module resolution of the package at C:\CODING STUFF\PROJECTS\bulut-search\frontend\node_modules\@iconify\vue\package.json imported from C:\CODING STUFF\PROJECTS\bul-search\frontend\node_modules\.pnpm\[email protected]\node_modules.
(node:20280) [DEP0166] DeprecationWarning: Use of deprecated double slash resolving ".//index.cjs" for module request ".//index.cjs" matched to "./*" in the "exports" field module resolution of the package at C:\CODING STUFF\PROJECTS\bulut-search\frontend\node_modules\@iconify\vue\package.json imported from C:\CODING STUFF\PROJECTS\bul-search\frontend\node_modules\.pnpm\[email protected]\node_modules.

package.json:

  "scripts": {
    "build": "nuxt build",
    "dev": "nuxt dev",
    "generate": "nuxt generate",
    "preview": "nuxt preview",
    "postinstall": "nuxt prepare",
    "lint": "eslint .",
    "lint:fix": "eslint . --fix"
  },
  "dependencies": {
    "@nuxt/eslint": "^0.3.10",
    "@nuxt/image": "^1.6.0",
    "@pinia/nuxt": "^0.5.1",
    "@radix-icons/vue": "^1.0.0",
    "@unovis/ts": "^1.4.0",
    "@unovis/vue": "^1.4.0",
    "@vee-validate/zod": "^4.12.6",
    "@vueuse/core": "^10.9.0",
    "class-variance-authority": "^0.7.0",
    "clsx": "^2.1.1",
    "embla-carousel": "^8.0.2",
    "embla-carousel-vue": "^8.0.2",
    "nuxt": "^3.11.2",
    "radix-vue": "^1.7.3",
    "tailwind-merge": "^2.3.0",
    "tailwindcss-animate": "^1.0.7",
    "v-calendar": "^3.1.2",
    "vaul-vue": "^0.1.0",
    "vee-validate": "^4.12.6",
    "vue": "^3.4.26",
    "vue-router": "^4.3.2",
    "vue-sonner": "^1.1.2",
    "vue-virtual-scroller": "2.0.0-beta.8",
    "zod": "^3.23.5"
  },
  "devDependencies": {
    "@nuxtjs/color-mode": "^3.4.1",
    "@nuxtjs/google-fonts": "^3.2.0",
    "@nuxtjs/i18n": "^8.3.1",
    "@nuxtjs/supabase": "^1.2.1",
    "@nuxtjs/tailwindcss": "^6.12.0",
    "nuxt-icon": "^0.6.10",
    "shadcn-nuxt": "^0.10.4",
    "typescript": "^5.4.5"
  }

onurusluca avatar Apr 30 '24 14:04 onurusluca

Issue similar to Iconify/iconify#283 exists.

Also, for Nuxt I recommend using iconify-icon package, not @iconify/vue. See Iconify Icon SSR for details.

eeg1412 avatar Jul 12 '24 09:07 eeg1412

Me too.But it doesn't seem to affect the program's operation

DbPtZn avatar Jul 24 '24 19:07 DbPtZn

Can anyone send a minimal reproduction so I can have a deeper look?

antfu avatar Jul 28 '24 12:07 antfu

@antfu here is the repro: https://github.com/ojvribeiro/nuxt-repro-deprecation-warning

It is a fresh Nuxt project and Nuxt Icon is the only module installed. When I run the build command the Deprecation Warning message is spammed:

image

ojvribeiro avatar Jul 28 '24 20:07 ojvribeiro

@antfu here is the repro: https://github.com/ojvribeiro/nuxt-repro-deprecation-warning

That reproduction doesn't show any warnings when running build command on MacOS or Linux.

Looking at this screenshot and previous screenshots, all reports use \ in path, so looks like a Windows only issue.

cyberalien avatar Jul 28 '24 20:07 cyberalien

Looking at this screenshot and previous screenshots, all reports use \ in path, so looks like a Windows only issue.

Actually, no, I have the similar issue on MacOS:

...
(node:9206) [DEP0166] DeprecationWarning: Use of deprecated double slash resolving ".//index.cjs" for module request ".//index.cjs" matched to "./*" in the "exports" field module resolution of the package at /Users/evermake/Code/project/node_modules/.pnpm/node_modules/@iconify/utils/package.json imported from /Users/evermake/Code/project/node_modules/.pnpm/[email protected][email protected][email protected]/.
(node:9206) [DEP0166] DeprecationWarning: Use of deprecated double slash resolving ".//index.js" for module request ".//index.js" matched to "./*" in the "exports" field module resolution of the package at /Users/evermake/Code/project/node_modules/.pnpm/node_modules/@iconify/utils/package.json imported from /Users/evermake/Code/project/node_modules/.pnpm/[email protected][email protected][email protected]/.
(node:9206) [DEP0166] DeprecationWarning: Use of deprecated double slash resolving ".//index.json" for module request ".//index.json" matched to "./*" in the "exports" field module resolution of the package at /Users/evermake/Code/project/node_modules/.pnpm/node_modules/@iconify/utils/package.json imported from /Users/evermake/Code/project/node_modules/.pnpm/[email protected][email protected][email protected]/.
... (and more similar issues below...)
npx envinfo --system --binaries --browsers

  System:
    OS: macOS 14.5
    CPU: (8) arm64 Apple M1
    Memory: 141.55 MB / 16.00 GB
    Shell: 3.7.1 - /opt/homebrew/bin/fish
  Binaries:
    Node: 20.13.1 - ~/Library/Caches/fnm_multishells/8351_1722461424558/bin/node
    npm: 10.5.2 - ~/Library/Caches/fnm_multishells/8351_1722461424558/bin/npm
    pnpm: 9.6.0 - ~/Library/Caches/fnm_multishells/8351_1722461424558/bin/pnpm
    bun: 1.1.20 - ~/.bun/bin/bun
  Browsers:
    Safari: 17.5

Seems like an issue is only with the @iconify packages.

evermake avatar Jul 31 '24 21:07 evermake

Actually, no, I have the similar issue on MacOS:

Can you post a reproduction?

cyberalien avatar Aug 01 '24 05:08 cyberalien

Same issue here

Running node 20.16.0 nuxt 3.12.3 @nuxt/icon 1.4.3

nwrman avatar Aug 01 '24 17:08 nwrman

Same issue here

Running node 20.16.0 nuxt 3.12.3 @nuxt/icon 1.4.3

On Windows?

cyberalien avatar Aug 01 '24 17:08 cyberalien

Yes, sorry, on windows

On Thu, Aug 1, 2024 at 11:11 AM Vjacheslav Trushkin < @.***> wrote:

Same issue here

Running node 20.16.0 nuxt 3.12.3 @nuxt/icon 1.4.3

On Windows?

— Reply to this email directly, view it on GitHub https://github.com/nuxt/icon/issues/140#issuecomment-2263555449, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJTQKTDEUJCAOHDQ3MUMUDZPJT2VAVCNFSM6AAAAABC6JNWGKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENRTGU2TKNBUHE . You are receiving this because you are subscribed to this thread.Message ID: @.***>

nwrman avatar Aug 01 '24 17:08 nwrman

i have same issue, Running node 20.16.0 nuxt 3.12.3 @nuxt/icon 1.4.3 OS: windows

shadKamel avatar Aug 02 '24 11:08 shadKamel