Novaterata
Novaterata

Reputation: 4805

Webpack cannot find module node_modules\node_modules on Windows

Bizarre error started happening on all our Windows environments:

node:internal/modules/cjs/loader:1146
  throw err;
  ^

Error: Cannot find module 'C:\Users\User\wireframe-tool\node_modules\node_modules\webpack\bin\webpack.js'
    at Module._resolveFilename (node:internal/modules/cjs/loader:1143:15)
    at Module._load (node:internal/modules/cjs/loader:984:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12)
    at node:internal/main/run_main_module:28:49 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

Why is node looking in ./node_modules/node_modules?

This is a Lerna 8 monorepo using Yarn 1.x, command happens whether I use lerna or yarn workspace commands. We are using nvm on the latest node LTS 20.12.2

Update: This only happens when webpack is invoked with npx. When invoked as just webpack it resolves correctly

Upvotes: 0

Views: 63

Answers (0)

Related Questions