sdk: Unable to load 'webpack-cli/serve' command on default app

After following the instructions for the quickstart guide of the hello app I got to this error.

$ npm start               

> hello_assets@0.1.0 prestart
> npm run copy:types


> hello_assets@0.1.0 copy:types
> rsync -avr .dfx/$(echo ${DFX_NETWORK:-'**'})/canisters/** --exclude='assets/' --exclude='idl/' --exclude='*.wasm' --delete src/declarations

building file list ... done

sent 310 bytes  received 20 bytes  660.00 bytes/sec
total size is 19112  speedup is 57.92

> hello_assets@0.1.0 start
> webpack serve --mode development --env development

[webpack-cli] Unable to load '@webpack-cli/serve' command
[webpack-cli] TypeError: options.forEach is not a function

It was solved by changing ‘webpack-cli’ version from “4.5.0” to “4.9.1”. Not a serious issue but might be helpful for new comers. This issue was found on MacOS with a M1 chipset.

If increasing the version doesn’t cause any issues I would gladly create a PR.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 5
  • Comments: 16 (2 by maintainers)

Most upvoted comments

Same issue following the quick start:

$ npm start



> hello_assets@0.1.0 prestart
> npm run copy:types


> hello_assets@0.1.0 copy:types
> rsync -avr .dfx/$(echo ${DFX_NETWORK:-'**'})/canisters/** --exclude='assets/' --exclude='idl/' --exclude='*.wasm' --exclude='*.most' --delete src/declarations

building file list ... done

sent 304 bytes  received 20 bytes  648.00 bytes/sec
total size is 19101  speedup is 58.95

> hello_assets@0.1.0 start
> webpack serve --mode development --env development

No production canister_ids.json found. Continuing with local
[webpack-cli] TypeError: cli.isMultipleCompiler is not a function
    at Command.<anonymous> (/Development/crypto/icp/hello/node_modules/@webpack-cli/serve/lib/index.js:146:35)
    at async Promise.all (index 1)
    at async Command.<anonymous> (/Development/crypto/icp/hello/node_modules/webpack-cli/lib/webpack-cli.js:1674:7)

Edit: Updating webpack version to 4.10.0 in the package.json and running npm install fixed the issue.

Related issue from webpack repo: https://github.com/webpack/webpack/issues/15951

Had the same issue. apecollector’s solution worked for me. Upgraded from “4.9.1” to “webpack-cli”: “4.10.0”

Had the same issue. Similar solution worked for me. Upgraded from “4.5.0” to “webpack-cli”: “4.9.0”

Came to make this issue but you beat me to it 😃

problem solved by updating webpack-cli version to 4.10.0 in package.json

“webpack-cli”: “4.10.0”; from “webpack-cli”: “4.9.2”;
{ npm install } to update {npm start}

I used nvm to install node LTS cd into the project folder used command: npm install webpack-cli@4.10.0

solved the error.