tailwindcss icon indicating copy to clipboard operation
tailwindcss copied to clipboard

`npm ls -a` reports unmet dependency errors on WASM package when installing `@tailwindcss/postcss`

Open foobar-star opened this issue 1 month ago • 7 comments

Possible Bug Report

What version of Tailwind CSS are you using? @tailwindcss/[email protected] and [email protected]

What build tool (or framework if it abstracts the build tool) are you using? npx create-next-app@latest or node.js

What version of Node.js are you using? v24.10.0 and v22.10.0

What browser are you using? N/A

What operating system are you using? Linux

Reproduction URL

Installing Tailwind CSS v4 in next.js projects or just plain node.js (specifically @tailwindcss/[email protected]) introduces either extraneous WebAssembly dependencies such as @emnapi/runtime(if using npm 11 and node version 22) or ESLProblems If using npm 11+ and node 24. In the former issue(node v 22) extraneous dependencies cannot be removed by standard methods (npm uninstall, npm prune, --ignore-scripts, etc.) and persist after installation and get reinstalled by post install scripts from napi-postinstall causing confusion and potentially interfering with clean environments or minimal builds.

Keep in mind these steps have only been identified when the sharp package is present either as a direct or as a transitive dependency. Sharp is a transitive dependency by default in all next.js projects.

You can reproduce these issues here: https://codesandbox.io/p/sandbox/github/vercel/next.js/tree/canary/examples/reproduction-template?file=%2F.gitignore

This issue originally was brought up here: https://github.com/vercel/next.js/issues/84450 and https://github.com/lovell/sharp/issues/4464 was thought to be caused by create-next-app, and the sharp packages Emscripten detection which uses similar WebAssembly binaries as tailwind and rebuilds them post-install https://github.com/lovell/sharp/issues/4442.

The two specific packages thought to explain the issue now are [email protected] and @tailwindcss/[email protected] by the way of tailwindcss/oxide-wasm32-wasi, unrs-resolver (optional dependency of eslint-config-next.js). See full explanation here: https://github.com/vercel/next.js/issues/84450#issuecomment-3393868023

Here are the exact steps to reproduce the issues using node version 22.10.0

To Reproduce

$ node -v
v22.10.0
$ npm -v
11.6.1

$ npx create-next-app@latest my-app -ts -tw -eslint
if flags are not working please select typescript, tailwind, and eslint


$ npm ls
[email protected] /project/workspace/my-app
├── @emnapi/[email protected] extraneous
├── @emnapi/[email protected] extraneous
├── @emnapi/[email protected] extraneous
├── @eslint/[email protected]
├── @napi-rs/[email protected] extraneous
├── @tailwindcss/[email protected]
├── @tybys/[email protected] extraneous
├── @types/[email protected]
├── @types/[email protected]
├── @types/[email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]

Traditional cleanup commands have no effect so running npm uninstall emnapi/[email protected] or other cleanup commands (npm prune, reinstalling, clearing caches, ignore scripts) does not remove it or Post Install scripts from optional dependencies make these persist. https://github.com/vercel/next.js/issues/84450#issuecomment-3393868023

OR with node 24+ and NPM 11+ and installing @tailwindcss/postcss as per lovell https://github.com/lovell/sharp/issues/4464#issuecomment-3401048107

$ node -v
v24.10.0

$ npm -v
11.6.1

$ cat package.json 
{
  "dependencies": {
    "@tailwindcss/postcss": "^4.1.14",
    "sharp": "^0.34.4"
  }
}

$ npm install

added 76 packages, and audited 77 packages in 2s

38 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

$ npm ls
├── @tailwindcss/[email protected]
└── [email protected]

$ ls -w1 node_modules/@img
colour
sharp-libvips-linux-x64
sharp-linux-x64

$ npm ls --all
├─┬ @tailwindcss/[email protected]
│ ├── @alloc/[email protected]
│ ├─┬ @tailwindcss/[email protected]
│ │ ├─┬ @jridgewell/[email protected]
│ │ │ ├─┬ @jridgewell/[email protected]
│ │ │ │ ├── @jridgewell/[email protected] deduped
│ │ │ │ └── @jridgewell/[email protected] deduped
│ │ │ └─┬ @jridgewell/[email protected]
│ │ │   ├── @jridgewell/[email protected]
│ │ │   └── @jridgewell/[email protected] deduped
│ │ ├─┬ [email protected]
│ │ │ ├── [email protected]
│ │ │ └── [email protected]
│ │ ├── [email protected]
│ │ ├─┬ [email protected]
│ │ │ ├── [email protected] deduped
│ │ │ ├── [email protected]
│ │ │ ├── [email protected]
│ │ │ ├── [email protected]
│ │ │ ├── [email protected]
│ │ │ ├── [email protected]
│ │ │ ├── [email protected]
│ │ │ ├── [email protected]
│ │ │ ├── [email protected]
│ │ │ ├── [email protected]
│ │ │ └── [email protected]
│ │ ├─┬ [email protected]
│ │ │ └── @jridgewell/[email protected]
│ │ ├── [email protected]
│ │ └── [email protected] deduped
│ ├─┬ @tailwindcss/[email protected]
│ │ ├── @tailwindcss/[email protected]
│ │ ├── @tailwindcss/[email protected]
│ │ ├── @tailwindcss/[email protected]
│ │ ├── @tailwindcss/[email protected]
│ │ ├── @tailwindcss/[email protected]
│ │ ├── @tailwindcss/[email protected]
│ │ ├── @tailwindcss/[email protected]
│ │ ├── @tailwindcss/[email protected]
│ │ ├── @tailwindcss/[email protected]
│ │ ├─┬ @tailwindcss/[email protected]
│ │ │ ├── UNMET DEPENDENCY @emnapi/core@^1.5.0
│ │ │ ├── @emnapi/[email protected] deduped
│ │ │ ├── UNMET DEPENDENCY @emnapi/wasi-threads@^1.1.0
│ │ │ ├── UNMET DEPENDENCY @napi-rs/wasm-runtime@^1.0.5
│ │ │ ├── UNMET DEPENDENCY @tybys/wasm-util@^0.10.1
│ │ │ └── [email protected]
│ │ ├── @tailwindcss/[email protected]
│ │ ├── @tailwindcss/[email protected]
│ │ ├── [email protected] deduped
│ │ └─┬ [email protected]
│ │   ├─┬ @isaacs/[email protected]
│ │   │ └── [email protected] deduped
│ │   ├── [email protected]
│ │   ├── [email protected]
│ │   ├─┬ [email protected]
│ │   │ └── [email protected] deduped
│ │   └── [email protected]
│ ├─┬ [email protected]
│ │ ├── [email protected]
│ │ ├── [email protected]
│ │ └── [email protected] deduped
│ └── [email protected]
└─┬ [email protected]
  ├── @img/[email protected]
  ├─┬ @img/[email protected]
  │ └── @img/[email protected] deduped
  ├─┬ @img/[email protected]
  │ └── @img/[email protected] deduped
  ├── @img/[email protected]
  ├── @img/[email protected]
  ├── @img/[email protected]
  ├── @img/[email protected]
  ├── @img/[email protected]
  ├── @img/[email protected]
  ├── @img/[email protected]
  ├── @img/[email protected]
  ├── @img/[email protected]
  ├─┬ @img/[email protected]
  │ └── @img/[email protected] deduped
  ├─┬ @img/[email protected]
  │ └── @img/[email protected] deduped
  ├─┬ @img/[email protected]
  │ └── @img/[email protected] deduped
  ├─┬ @img/[email protected]
  │ └── @img/[email protected] deduped
  ├─┬ @img/[email protected]
  │ └── @img/[email protected] deduped
  ├─┬ @img/[email protected]
  │ └── @img/[email protected] deduped
  ├─┬ @img/[email protected]
  │ └── @img/[email protected] deduped
  ├─┬ @img/[email protected]
  │ └─┬ @emnapi/[email protected]
  │   └── [email protected] deduped
  ├── @img/[email protected]
  ├── @img/[email protected]
  ├── @img/[email protected]
  ├── [email protected]
  └── [email protected]

npm error code ELSPROBLEMS
npm error missing: @emnapi/core@^1.5.0, required by @tailwindcss/[email protected]
npm error missing: @emnapi/wasi-threads@^1.1.0, required by @tailwindcss/[email protected]
npm error missing: @napi-rs/wasm-runtime@^1.0.5, required by @tailwindcss/[email protected]
npm error missing: @tybys/wasm-util@^0.10.1, required by @tailwindcss/[email protected]

additional steps taken to identify/resolve the underlying issue shared below

$ node -v
v24.10.0
$ npm -v
11.6.1
$ npx create-next-app@latest my-app -ts -tw -eslint (if these options do not work please just select typescript, tailwind, and eslint from the prompt)

$ npm ls -all | grep -i invalid
│ │ │ ├─┬ @napi-rs/[email protected] invalid: "^1.0.5" from node_modules/@tailwindcss/oxide-wasm32-wasi
│ │   │ └── @napi-rs/[email protected] deduped invalid: "^1.0.5" from node_modules/@tailwindcss/oxide-wasm32-wasi
npm error code ELSPROBLEMS
npm error invalid: @napi-rs/[email protected] /project/workspace/my-app/node_modules/@napi-rs/wasm-runtime


$ rm -rf node_modules/sharp   
$ rm package-lock.json     
$ npm cache clean --force

$ npm install


$ npm ls -all | grep -i invalid
$

and also here for node version 22 LTS

$ node -v
v22.10.0
$ npm -v
11.6.1

$ npx create-next-app@latest my-app -ts -tw -eslint
if flags are not working please select typescript, tailwind, and eslint


$ npm ls
[email protected] /project/workspace/my-app
├── @emnapi/[email protected] extraneous
├── @emnapi/[email protected] extraneous
├── @emnapi/[email protected] extraneous
├── @eslint/[email protected]
├── @napi-rs/[email protected] extraneous
├── @tailwindcss/[email protected]
├── @tybys/[email protected] extraneous
├── @types/[email protected]
├── @types/[email protected]
├── @types/[email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]


$ npm ls -all | grep -i invalid
$ 
$ rm -rf node_modules/sharp 
$ rm package-lock.json
$ npm cache clean --force
$ npm install sharp --no-optional
$ npm ls            
[email protected] /project/workspace/my-app
├── @eslint/[email protected]
├── @tailwindcss/[email protected]
├── @types/[email protected]
├── @types/[email protected]
├── @types/[email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]

$ npm ls -all | grep -i invalid
$

Sometimes removing the optional deps of Sharp resolved the issues entirely (as did it with tailwind or eslint). However, the sharp maintainer mentioned this is probably a question better suited for the @tailwindcss/oxide-wasm32-wasi maintainer and if not may be a bug with NPM.

Thank you!

foobar-star avatar Oct 16 '25 21:10 foobar-star