Error making the build from webpack


How are you? I'm taking my first steps with webpack and I found a problem that I can not solve, when trying to make the build of a file js , I get the following error:

webpack test.js app.js
The CLI moved into a separate package: webpack-cli
Would you like to install webpack-cli? (That will run npm install -D webpack-cli) (yes/NO)yes

When you give yes the installation starts, which ends with the following error:


npm WARN deprecated [email protected]: Thanks for using   Babel: we recommend using babel-preset-env now: please read to update! npm WARN deprecated [email protected]: Package no   longer supported. Contact [email protected] for more info.   D: _PROJECTS \ deploy '- [email protected]


npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected]^1.1.2   (node_modules \ chokidar \ node_modules \ fsevents): npm WARN notsup   SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]:   wanted {"os": "darwin", "arch": "any"} (current:   {"os": "win32", "arch": "x64"}) {Error: Can not find module 'webpack-cli'       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 runCommand.then.result (C: \ Users \ santa 64 \ AppData \ Roaming \ npm \ node_modules \ webpack \ bin \ webpack.js: 62: 14)       at process._tickCallback (internal / process / next_tick.js: 109: 7) code: 'MODULE_NOT_FOUND'}

Then I try again to execute the webpack command to make the build

webpack test.js app.js

But again I get the same mistake and I can not continue.

asked by Pablo 19.04.2018 в 23:54

2 answers


@jackNavRow gave me the answer on how to lower the dependency that was missing. With this I am already able to execute the webpack command that gave error

npm i webpack-cli -g


answered by 20.04.2018 в 14:55

The lines you show give you the solution:

npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

This line is telling you that the fsevents package is only available for darwin (OSX, mac) and you are at Win32(windows) .

Specifically, one of the dependencies can not be installed.

answered by 20.04.2018 в 00:01