Webpack-cli: Cannot run webpack-cli after install

Created on 12 Oct 2017  ·  30Comments  ·  Source: webpack/webpack-cli

After trying to run "webpack-cli" for config migrating, I got this error output.
macOS Sierra 10.12.6
npm v5.4.2
node v8.7.0 (installed via nvm)
webpack-cli v1.3.9

npm i -g webpack-cli
webpack-cli migrate webpack.config.js

module.js:529
    throw err;
    ^

Error: Cannot find module './utils/webpackOptionsSchema.json'
    at Function.Module._resolveFilename (module.js:527:15)
    at Function.Module._load (module.js:476:23)
    at Module.require (module.js:568:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/Users/dphov/.nvm/versions/node/v8.7.0/lib/node_modules/webpack-cli/dist/migrate.js:10:30)
    at Module._compile (module.js:624:30)
    at Object.Module._extensions..js (module.js:635:10)
    at Module.load (module.js:545:32)
    at tryModuleLoad (module.js:508:12)
    at Function.Module._load (module.js:500:3)

Most helpful comment

Do npm install -g webpack-cli, it should have 1.4.0 now, reverted some things, as @ematipico did a PR for flow that made the build broken, tried to fix it by adding compilation and stuff, so that we could support v4 of node, will do some more investigating to make sure it works 100%. Sorry for the bug you guys had, having a hard time finding time for open source atm, as I'm working + full time student :(

As mentioned earlier, would be super-awesome if someone made a PR that fixes distribution and flow-compilation

All 30 comments

Hi @dphov, which version of webpack-cli did you install? The latest? (1.3.9)

@ematipico Yep.

Same error here

Looks like a bad release?

(master ✎ ) +1 $ ls node_modules/webpack-cli/lib/utils/ | grep webpackOptionsSchema.json
webpackOptionsSchema.json

(master ✎ ) +1 $ ls node_modules/webpack-cli/dist/utils/ | grep webpackOptionsSchema.json

Also why is the dist/ folder committed at all? Easy win to remove it, and ignore the source code from the published package with a .npmignore

Yep, bad rebase indeed. We need a solid build step, so if someone want's to fix prepublish and creating a dist build that actually works, that would be great. There's a PR for it, but we need to only create the dist folder, and flow-remove-types doesn't seem to work with prepublish. Would be super-humble for a PR to fix this

FWIW, the 1.9 version should actually work, could you do a deep dive into node_modules in global and try to run webpack with something like node ~/usr/bin/local/node_modules/webpack/webpack.js init ?

Looks like last five* versions are hosed too?

yarn add -D [email protected]
yarn add v0.23.4
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[4/4] 📃  Building fresh packages...
[1/1] ⠄ webpack-cli
error node_modules/webpack-cli: Command failed.
Exit code: 1
Command: sh
Arguments: -c node ./node_modules/flow-remove-types/flow-remove-types lib/ -d dist/
Directory: node_modules/webpack-cli
Output:
module.js:473
      throw err;
      ^

Error: Cannot find module 'node_modules/webpack-cli/node_modules/flow-remove-types/flow-remove-types'

same output for yarn add -D [email protected]

This succeeded: yarn add -D [email protected], but then...

webpack-cli migrate webpack/dev.config.js
module.js:529
    throw err;
    ^

Error: Cannot find module '../dist/migrate.js'

Same for yarn add -D [email protected]...

Am I missing something? Have the last 5+ releases not worked?

correct, was planning to bump to 1.4.0 once this got fixed

1.3.4 and 1.3.9 should work, I'm interested in the trace for 1.3.9

Install for 1.3.9 works but error is in the first post

Do npm install -g webpack-cli, it should have 1.4.0 now, reverted some things, as @ematipico did a PR for flow that made the build broken, tried to fix it by adding compilation and stuff, so that we could support v4 of node, will do some more investigating to make sure it works 100%. Sorry for the bug you guys had, having a hard time finding time for open source atm, as I'm working + full time student :(

As mentioned earlier, would be super-awesome if someone made a PR that fixes distribution and flow-compilation

Closing this per now, feel free to open a new issue if something comes up, I'm available for questions or elaboration anytime ❤️

still happening:
Error: Cannot find module './utils/webpackOptionsSchema.json'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object. (/usr/local/lib/node_modules/webpack-cli/dist/migrate.js:10:30)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
timo$ webpack-cli --version
1.4.4

Try reinstalling to the newest version

same on 1.4.4

Install the latest version @anisart

@ev1stensberg but how? I install it via

npm i -g webpack-cli

@anisart flow-remove-types doesn't want to copy over json files, sadly :(

Sorry for the errors you were getting, try npm install -g [email protected] or npm update -g webpack-cli

I'm having this error when I try to run foreman:

foreman start
15:49:28 web.1     | started with pid 3626
15:49:28 webpack.1 | started with pid 3627
15:49:30 webpack.1 | internal/modules/cjs/loader.js:573
15:49:30 webpack.1 |     throw err;
15:49:30 webpack.1 |     ^
15:49:30 webpack.1 |
15:49:30 webpack.1 | Error: Cannot find module 'webpack/schemas/WebpackOptions.json'
15:49:30 webpack.1 |     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:571:15)
15:49:30 webpack.1 |     at Function.Module._load (internal/modules/cjs/loader.js:497:25)
15:49:30 webpack.1 |     at Module.require (internal/modules/cjs/loader.js:626:17)
15:49:30 webpack.1 |     at require (internal/modules/cjs/helpers.js:20:18)
15:49:30 webpack.1 |     at Object.<anonymous> (/Users/romenigld/ror_workspace/tutorials/onebitcode/onebitflix/node_modules/webpack-cli/bin/config-yargs.js:1:85)
15:49:30 webpack.1 |     at Module._compile (internal/modules/cjs/loader.js:678:30)
15:49:30 webpack.1 |     at Object.Module._extensions..js (internal/modules/cjs/loader.js:689:10)
15:49:30 webpack.1 |     at Module.load (internal/modules/cjs/loader.js:589:32)
15:49:30 webpack.1 |     at tryModuleLoad (internal/modules/cjs/loader.js:528:12)
15:49:30 webpack.1 |     at Function.Module._load (internal/modules/cjs/loader.js:520:3)
15:49:30 webpack.1 | exited with code 1
15:49:30 system    | sending SIGTERM to all processes
15:49:30 web.1     | terminated by SIGTERM

I am having the following error:

[email protected] build /Users/juangarcia/projects/testReactFull
webpack-cli

internal/modules/cjs/loader.js:596
throw err;
^

Error: Cannot find module 'webpack/schemas/WebpackOptions.json'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:594:15)
at Function.Module._load (internal/modules/cjs/loader.js:520:25)
at Module.require (internal/modules/cjs/loader.js:650:17)
at require (/Users/juangarcia/projects/testReactFull/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
at Object. (/Users/juangarcia/projects/testReactFull/node_modules/webpack-cli/bin/config-yargs.js:1:85)
at Module._compile (/Users/juangarcia/projects/testReactFull/node_modules/v8-compile-cache/v8-compile-cache.js:178:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10)
at Module.load (internal/modules/cjs/loader.js:612:32)
at tryModuleLoad (internal/modules/cjs/loader.js:551:12)
at Function.Module._load (internal/modules/cjs/loader.js:543:3)

webpack-cli version 2.1.4
npm I used 6.1.0
node version v10.2.1

I update and reinstall for a new version of webpack(3.12.0) and solve.

webpack-cli migrate ./webpack.config.js

I was also having same problem, I fixed it by running the below command.
npm install [email protected] --save

Run webpack-cli v.3.0.1 and above to fix this

@ev1stensberg The two solutions you presented webpack-cli migrate ./webpack.config.js and getting the version v.3.0.1 and above works like a charm

WhatsApp Image 2019-12-12 at 12 41 27 PM (2)
WhatsApp Image 2019-12-12 at 12 41 27 PM (1)
WhatsApp Image 2019-12-12 at 12 41 27 PM
@evenstensberg please help me out of this

Got this issue today. Running windows 10 and

"webpack-cli": "^4.6.0"

I can fix by installing globally and linking locally.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

evenstensberg picture evenstensberg  ·  5Comments

anshumanv picture anshumanv  ·  3Comments

Pomax picture Pomax  ·  3Comments

sumukhah picture sumukhah  ·  3Comments

sam-s4s picture sam-s4s  ·  5Comments