Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
danperks opened this issue Feb 7, 2024 · 36 comments
Open
Labels
help wanted Extra attention is needed upstream

Comments

@danperks
Copy link

danperks commented Feb 7, 2024

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 danperks changed the title Deprecation Warning on Nuxt.js build due to package.json export [BUG] Deprecation Warning on Nuxt.js build due to package.json export Feb 7, 2024
@hmingv
Copy link

hmingv commented Feb 22, 2024

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

@cyberalien
Copy link

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.

@hmingv
Copy link

hmingv commented Feb 23, 2024

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

@KarelVendla
Copy link

I also have this in my project

Running
node 20.11.0
nuxt 3.8.2
nuxt-icon 0.6.8

@ausir0726
Copy link

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
nuxt/starter@9afba5d

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

@lx-elephantxiang
Copy link

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

@Kram-V
Copy link

Kram-V commented Apr 23, 2024

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

@kleinpetr
Copy link

same here, after upgrading Nuxt from 3.9.3 to 3.11.2

image

@Kram-V
Copy link

Kram-V commented Apr 30, 2024

@kleinpetr can we downgrade the nuxt app?

@kleinpetr
Copy link

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

@Kram-V
Copy link

Kram-V commented Apr 30, 2024

@kleinpetr ok tnx

@kleinpetr
Copy link

@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...

@cyberalien
Copy link

@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

@Kram-V
Copy link

Kram-V commented Apr 30, 2024

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

@Kram-V
Copy link

Kram-V commented Apr 30, 2024

@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?

@cyberalien
Copy link

Remove ^ from version number

@Kram-V
Copy link

Kram-V commented Apr 30, 2024

@cyberalien ok sir I will try

@Kram-V
Copy link

Kram-V commented Apr 30, 2024

@cyberalien it worked, thank you so much sir!

@onurusluca
Copy link

onurusluca commented Apr 30, 2024

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\nitropack@2.9.6\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\nitropack@2.9.6\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\nitropack@2.9.6\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"
  }

@eeg1412
Copy link

eeg1412 commented Jul 12, 2024

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.

@DbPtZn
Copy link

DbPtZn commented Jul 24, 2024

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

@antfu
Copy link
Member

antfu commented Jul 28, 2024

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

@ojvribeiro
Copy link

@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

@cyberalien
Copy link

@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.

@evermake
Copy link

evermake commented Jul 31, 2024

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/nitropack@2.9.7_encoding@0.1.13_magicast@0.3.4/.
(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/nitropack@2.9.7_encoding@0.1.13_magicast@0.3.4/.
(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/nitropack@2.9.7_encoding@0.1.13_magicast@0.3.4/.
... (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.

@cyberalien
Copy link

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

Can you post a reproduction?

@nwrman
Copy link

nwrman commented Aug 1, 2024

Same issue here

Running
node 20.16.0
nuxt 3.12.3
@nuxt/icon 1.4.3

@cyberalien
Copy link

Same issue here

Running node 20.16.0 nuxt 3.12.3 @nuxt/icon 1.4.3

On Windows?

@nwrman
Copy link

nwrman commented Aug 1, 2024 via email

@shadKamel
Copy link

shadKamel commented Aug 2, 2024

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

@evermake
Copy link

evermake commented Aug 8, 2024

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

Can you post a reproduction?

Sorry, but not for now. Had this in issue in a private project with many dependencies. Probably, will share a reproduction if the problem will remain and I'll have more time to investigate.

@thyngster
Copy link

thyngster commented Aug 28, 2024

I was "trying" to find a fix for this. My current test env,. is latest nuxt + latest vueuse .

  "dependencies": {
    "@vueuse/core": "^11.0.3",
    "nuxt": "^3.13.0",
    "vue": "latest"
  },

I'm seeing the issue also happening only starting from Nitro 2.6.0 ( ie downgrading to 2.5.2 will prevent the error to show up ) , not the best option since for example there's not ESM WASM support.

So not sure if this is totally related to Nuxt part or Nitro at all.

Deprecation Trace: ( node --trace-deprecation node_modules/nuxt/bin/nuxt.mjs build )

Building Nitro Server (preset: node-server)                                                                                                                                    nitro 3:23:52 AM
(node:40556) [DEP0155] DeprecationWarning: Use of deprecated trailing slash pattern mapping "./" in the "exports" field module resolution of the package at C:\Users\david\Documents\my-nuxt-app\node_modules\@vueuse\core\package.json imported from C:\Users\david\Documents\my-nuxt-app\node_modules. Mapping specifiers ending in "/" is no longer supported.
    at emitTrailingSlashPatternDeprecation (file:///C:/Users/david/Documents/my-nuxt-app/node_modules/mlly/dist/index.mjs:1526:13)
    at packageExportsResolve (file:///C:/Users/david/Documents/my-nuxt-app/node_modules/mlly/dist/index.mjs:1602:9)
    at packageResolve (file:///C:/Users/david/Documents/my-nuxt-app/node_modules/mlly/dist/index.mjs:1859:14)
    at moduleResolve (file:///C:/Users/david/Documents/my-nuxt-app/node_modules/mlly/dist/index.mjs:1954:18)
    at _tryModuleResolve (file:///C:/Users/david/Documents/my-nuxt-app/node_modules/mlly/dist/index.mjs:2023:12)
    at _resolve (file:///C:/Users/david/Documents/my-nuxt-app/node_modules/mlly/dist/index.mjs:2078:16)
    at resolveSync (file:///C:/Users/david/Documents/my-nuxt-app/node_modules/mlly/dist/index.mjs:2111:10)
    at resolvePathSync (file:///C:/Users/david/Documents/my-nuxt-app/node_modules/mlly/dist/index.mjs:2121:24)
    at resolvePath (file:///C:/Users/david/Documents/my-nuxt-app/node_modules/mlly/dist/index.mjs:2125:28)
    at _resolve (file:///C:/Users/david/Documents/my-nuxt-app/node_modules/nitropack/dist/shared/nitro.82977d3c.mjs:461:22)
(node:40556) [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:\Users\david\Documents\my-nuxt-app\node_modules\@vueuse\core\package.json imported from C:\Users\david\Documents\my-nuxt-app\node_modules.
    at emitInvalidSegmentDeprecation (file:///C:/Users/david/Documents/my-nuxt-app/node_modules/mlly/dist/index.mjs:917:13)
    at resolvePackageTargetString (file:///C:/Users/david/Documents/my-nuxt-app/node_modules/mlly/dist/index.mjs:1301:9)
    at resolvePackageTarget (file:///C:/Users/david/Documents/my-nuxt-app/node_modules/mlly/dist/index.mjs:1363:12)
    at packageExportsResolve (file:///C:/Users/david/Documents/my-nuxt-app/node_modules/mlly/dist/index.mjs:1629:27)
    at packageResolve (file:///C:/Users/david/Documents/my-nuxt-app/node_modules/mlly/dist/index.mjs:1859:14)
    at moduleResolve (file:///C:/Users/david/Documents/my-nuxt-app/node_modules/mlly/dist/index.mjs:1954:18)
    at _tryModuleResolve (file:///C:/Users/david/Documents/my-nuxt-app/node_modules/mlly/dist/index.mjs:2023:12)
    at _resolve (file:///C:/Users/david/Documents/my-nuxt-app/node_modules/mlly/dist/index.mjs:2084:20)
    at resolveSync (file:///C:/Users/david/Documents/my-nuxt-app/node_modules/mlly/dist/index.mjs:2111:10)
    at resolvePathSync (file:///C:/Users/david/Documents/my-nuxt-app/node_modules/mlly/dist/index.mjs:2121:24)
✔ Nitro server built                                                                                                                                                             nitro 3:23:54 AM

Also not only DEP0166 is triggered also the DEP0155. may be it related at some poting to nitrojs/nitro#2523 ?

@WilliamFalci
Copy link

Hello guys,

by all my test:

  • OS: Window
  • Node: 18.x - 20.x - 22.x

I confirm the issue is only on Windows, after windows I tried Ubuntu and everything worked without changes

@dencs08
Copy link

dencs08 commented Sep 19, 2024

Running pnpm build or npm run build throws

Use of deprecated trailing slash pattern mapping... or Use of deprecated doulbe slash resolving...

It happens only on windows while on macos it builds perfectly fine.

@itpropro
Copy link

Just in case anyone comes across this and wants to suppress the errors, you can prepend you script in your package.json with this under Windows until the bug is fixed:

set NODE_OPTIONS=--disable-warning=DEP0155 --disable-warning=DEP0166 &&

  "scripts": {
    "build": "set NODE_OPTIONS=--disable-warning=DEP0155 --disable-warning=DEP0166 && nitro build",

cross-env would be the better choice for cross platform, but this is just temporary until the cause was found.

@tinegaCollins
Copy link

was this issue fixed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed upstream
Projects
None yet
Development

No branches or pull requests