evenstensberg / webpack-scaffold-demo

Demo of a webpack-scaffold
MIT License
20 stars 2 forks source link

Error: Cannot find module 'webpack-cli' #6

Open lornally opened 3 years ago

lornally commented 3 years ago

when i run this cmd:

webpack init webpack-scaffold-demo

we get this info:

$ webpack init webpack-scaffold-demo
One CLI for webpack must be installed. These are recommended choices, delivered as separate packages:
 - webpack-cli (https://github.com/webpack/webpack-cli)
   The original webpack full-featured CLI.
We will use "npm" to install the CLI via "npm install -D".
Do you want to install 'webpack-cli' (yes/no): yes
Installing 'webpack-cli' (running 'npm install -D webpack-cli')...
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated

added 712 packages, and audited 713 packages in 2m

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

found 0 vulnerabilities
Error: Cannot find module 'webpack-cli'
Require stack:
- /Users/bergman/.config/yarn/global/node_modules/webpack/bin/webpack.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:925:15)
    at Function.Module._load (node:internal/modules/cjs/loader:769:27)
    at Module.require (node:internal/modules/cjs/loader:997:19)
    at require (node:internal/modules/cjs/helpers:92:18)
    at /Users/bergman/.config/yarn/global/node_modules/webpack/bin/webpack.js:143:5
    at processTicksAndRejections (node:internal/process/task_queues:93:5) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/bergman/.config/yarn/global/node_modules/webpack/bin/webpack.js'
  ]
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
lornally commented 3 years ago

when i run yarn, then run this again, there is another errer:

$ webpack init webpack-scaffold-demo

up to date, audited 1 package in 241ms

found 0 vulnerabilities
node:events:353
      throw er; // Unhandled 'error' event
      ^

TypeError: self.prompt is not a function
    at List (/usr/local/lib/node_modules/webpack-scaffold-demo/node_modules/@webpack-cli/webpack-scaffold/index.js:51:17)
    at WebpackGenerator.prompting (/usr/local/lib/node_modules/webpack-scaffold-demo/generator.js:18:4)
    at Object.<anonymous> (/usr/local/lib/node_modules/webpack-scaffold-demo/node_modules/yeoman-generator/lib/index.js:424:27)
    at /usr/local/lib/node_modules/webpack-scaffold-demo/node_modules/run-async/index.js:49:25
    at new Promise (<anonymous>)
    at /usr/local/lib/node_modules/webpack-scaffold-demo/node_modules/run-async/index.js:26:19
    at /usr/local/lib/node_modules/webpack-scaffold-demo/node_modules/yeoman-generator/lib/index.js:425:13
    at processImmediate (node:internal/timers:463:21)
Emitted 'error' event on WebpackGenerator instance at:
    at Immediate.<anonymous> (/usr/local/lib/node_modules/webpack-scaffold-demo/node_modules/yeoman-generator/lib/index.js:433:22)
    at processImmediate (node:internal/timers:463:21)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.