Gutenberg: Error with npx @wordpress/create-block

Created on 28 Oct 2020  Â·  8Comments  Â·  Source: WordPress/gutenberg

I have a problem with npx @wordpress/create-block. When I run it I get this error:

stampirl@DESKTOP-GTK805J:~/code/wordpress$ npx @wordpress/create-block hero-slider
npx: installed 214 in 12.586s

Creating a new WordPress block in "hero-slider" folder.

Creating a "block.json" file.

Creating a "package.json" file.

Installing packages. It might take a couple of minutes.

Formatting JavaScript files.

Compiling block.
(node:21) UnhandledPromiseRejectionWarning: Error: Command failed with exit code 1: npm run build
/home/stampirl/code/wordpress/hero-slider/node_modules/ignore-emit-webpack-plugin/index.js:64
                compilation.hooks.processAssets.tap({
                                                ^

TypeError: Cannot read property 'tap' of undefined
    at /home/stampirl/code/wordpress/hero-slider/node_modules/ignore-emit-webpack-plugin/index.js:64:49
    at SyncHook.eval [as call] (eval at create (/home/stampirl/code/wordpress/hero-slider/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:9:1)
    at SyncHook.lazyCompileHook (/home/stampirl/code/wordpress/hero-slider/node_modules/tapable/lib/Hook.js:154:20)
    at Compiler.newCompilation (/home/stampirl/code/wordpress/hero-slider/node_modules/webpack/lib/Compiler.js:631:26)
    at /home/stampirl/code/wordpress/hero-slider/node_modules/webpack/lib/Compiler.js:667:29
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/home/stampirl/code/wordpress/hero-slider/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
    at AsyncSeriesHook.lazyCompileHook (/home/stampirl/code/wordpress/hero-slider/node_modules/tapable/lib/Hook.js:154:20)
    at Compiler.compile (/home/stampirl/code/wordpress/hero-slider/node_modules/webpack/lib/Compiler.js:662:28)
    at /home/stampirl/code/wordpress/hero-slider/node_modules/webpack/lib/Compiler.js:321:11
    at Compiler.readRecords (/home/stampirl/code/wordpress/hero-slider/node_modules/webpack/lib/Compiler.js:529:11)
    at /home/stampirl/code/wordpress/hero-slider/node_modules/webpack/lib/Compiler.js:318:10
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/home/stampirl/code/wordpress/hero-slider/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
    at AsyncSeriesHook.lazyCompileHook (/home/stampirl/code/wordpress/hero-slider/node_modules/tapable/lib/Hook.js:154:20)
    at /home/stampirl/code/wordpress/hero-slider/node_modules/webpack/lib/Compiler.js:315:19
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/home/stampirl/code/wordpress/hero-slider/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
    at AsyncSeriesHook.lazyCompileHook (/home/stampirl/code/wordpress/hero-slider/node_modules/tapable/lib/Hook.js:154:20)
    at Compiler.run (/home/stampirl/code/wordpress/hero-slider/node_modules/webpack/lib/Compiler.js:312:24)
    at processOptions (/home/stampirl/code/wordpress/hero-slider/node_modules/webpack-cli/bin/cli.js:353:14)
    at /home/stampirl/code/wordpress/hero-slider/node_modules/webpack-cli/bin/cli.js:364:3
    at Object.parse (/home/stampirl/code/wordpress/hero-slider/node_modules/webpack-cli/node_modules/yargs/yargs.js:576:18)
    at /home/stampirl/code/wordpress/hero-slider/node_modules/webpack-cli/bin/cli.js:49:8
    at Object.<anonymous> (/home/stampirl/code/wordpress/hero-slider/node_modules/webpack-cli/bin/cli.js:366:3)
    at Module._compile (internal/modules/cjs/loader.js:1076:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10)
    at Module.load (internal/modules/cjs/loader.js:941:32)
    at Function.Module._load (internal/modules/cjs/loader.js:782:14)
    at Module.require (internal/modules/cjs/loader.js:965:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (/home/stampirl/code/wordpress/hero-slider/node_modules/webpack/bin/webpack.js:156:2)
    at Module._compile (internal/modules/cjs/loader.js:1076:30)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: `wp-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/stampirl/.npm/_logs/2020-10-28T17_50_01_432Z-debug.log

> [email protected] build /home/stampirl/code/wordpress/hero-slider
> wp-scripts build

    at makeError (/home/stampirl/.npm/_npx/21/lib/node_modules/@wordpress/create-block/node_modules/execa/lib/error.js:59:11)
    at handlePromise (/home/stampirl/.npm/_npx/21/lib/node_modules/@wordpress/create-block/node_modules/execa/index.js:114:26)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async module.exports (/home/stampirl/.npm/_npx/21/lib/node_modules/@wordpress/create-block/lib/init-wp-scripts.js:29:2)
    at async module.exports (/home/stampirl/.npm/_npx/21/lib/node_modules/@wordpress/create-block/lib/scaffold.js:82:3)
    at async Command.<anonymous> (/home/stampirl/.npm/_npx/21/lib/node_modules/@wordpress/create-block/lib/index.js:88:6)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:21) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:21) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
[Package] Create Block [Package] Scripts [Status] In Progress [Type] Bug

Most helpful comment

Looks like the issue is with [email protected] https://github.com/mrbar42/ignore-emit-webpack-plugin/issues/17 — it should be fixed if we pin the dependency in @wordpress/scripts to 2.0.3, until they fix it.

All 8 comments

I'm seeing the same. Additionally if I try to run an npm run build in the block dir I just tried to create I get the same error.

I haven't been able to fix this in a clean install, even trying to pull an earlier version, wp-scripts build is completely broken

Not sure this is a problem with @wordpress/create-block - I am using @wordpress/scripts on its own, and I get the exact same error when I try to run wp-scripts start. Version 12.4.0.

I had a different project running on @wordpress/scripts 12.2.1, which worked fine, so I downgraded to 12.2.1, but that did not fix the problem. Maybe a problem with a dependency?

Looks like the issue is with [email protected] https://github.com/mrbar42/ignore-emit-webpack-plugin/issues/17 — it should be fixed if we pin the dependency in @wordpress/scripts to 2.0.3, until they fix it.

+1, I was able to pin the dependency to 2.0.3 in our plugin's package.json, and that allowed us to run the build script successfully.

I was able to replicate this issue as well :(

Hotfix ready: https://github.com/WordPress/gutenberg/pull/26591. I should merge soon and proceed with npm publish.

Published the fix to npm:

- @wordpress/[email protected]
 - @wordpress/[email protected]
 - @wordpress/[email protected]
 - @wordpress/[email protected]

It fixes the issue for me.

Was this page helpful?
0 / 5 - 0 ratings