Description
Used npx @wordpress/create-block to create a block, it fails. It will create package directories under node_modules/, but they are all empty inside.
Step-by-step reproduction instructions
Just run npx @wordpress/create-block
Expected behaviour
Creates block as per documented.
Note:
Some googling of "Error: Command failed with exit code 127" lead me to similar errors in Yarn package, where people suggesting "delete node_modules/ and do npm install again" -- this seem to solve though no sure why.
So I tried same, and this completed installation. Not sure why.
cd my-blocks
rm -rf node_modules/
npm install
Anyhow, npx @wordpress/create-block should just work.
Code snippet (optional)
npx @wordpress/create-block
Let's customize your block:
? The block slug used for identification (also the plugin and output folder name
): my-blocks
? The internal namespace for the block name (something unique for your products)
: my-blocks
? The display title for your block: My Blocks
? The short description for your block (optional): Example block written with ES
Next standard and JSX support – build step required.
? The dashicon to make it easier to identify your block (optional): smiley
? The category name to help users browse and discover your block: widgets
? The name of the plugin author (optional). Multiple authors may be listed using
commas: waviaei
? The short name of the plugin’s license (optional): GPL-2.0-or-later
? A link to the full text of the license (optional): https://www.gnu.org/license
s/gpl-2.0.html
? The current version number of the plugin: 0.1.0
Creating a new WordPress block in "my-blocks" folder.
Creating a "block.json" file.
Creating a "package.json" file.
Installing npm dependencies. It might take a couple of minutes...
Installing @wordpress/scripts package. It might take a couple of minutes...
Formatting JavaScript files.
/Users/toru/.npm/_npx/0890e296436e9575/node_modules/execa/lib/error.js:59
error = new Error(message);
^
Error: Command failed with exit code 127: npm run format:js
sh: wp-scripts: command not found
npm ERR! code 127
npm ERR! path /Users/toru/Sites/sandbox/my-blocks
npm ERR! command failed
npm ERR! command sh -c wp-scripts format-js
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/toru/.npm/_logs/2021-02-07T03_19_19_705Z-debug.log
my-blocks@0.1.0 format:js
wp-scripts format-js
at makeError (/Users/toru/.npm/_npx/0890e296436e9575/node_modules/execa/lib/error.js:59:11)
at handlePromise (/Users/toru/.npm/_npx/0890e296436e9575/node_modules/execa/index.js:114:26)
at processTicksAndRejections (node:internal/process/task_queues:93:5)
at async module.exports (/Users/toru/.npm/_npx/0890e296436e9575/node_modules/@wordpress/create-block/lib/init-wp-scripts.js:25:2)
at async module.exports (/Users/toru/.npm/_npx/0890e296436e9575/node_modules/@wordpress/create-block/lib/scaffold.js:96:3)
at async Command.<anonymous> (/Users/toru/.npm/_npx/0890e296436e9575/node_modules/@wordpress/create-block/lib/index.js:100:6) {
shortMessage: 'Command failed with exit code 127: npm run format:js',
command: 'npm run format:js',
exitCode: 127,
signal: undefined,
signalDescription: undefined,
stdout: '\n> my-blocks@0.1.0 format:js\n> wp-scripts format-js\n',
stderr: 'sh: wp-scripts: command not found\n' +
'npm ERR! code 127\n' +
'npm ERR! path /Users/toru/Sites/sandbox/my-blocks\n' +
'npm ERR! command failed\n' +
'npm ERR! command sh -c wp-scripts format-js\n' +
'\n' +
'npm ERR! A complete log of this run can be found in:\n' +
'npm ERR! /Users/toru/.npm/_logs/2021-02-07T03_19_19_705Z-debug.log',
failed: true,
timedOut: false,
isCanceled: false,
killed: false
}
npm ERR! code 1
npm ERR! path /Users/toru/Sites/sandbox
npm ERR! command failed
npm ERR! command sh -c wp-create-block
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/toru/.npm/_logs/2021-02-07T03_19_19_766Z-debug.log
Below is the output doing deletion of node modules and doing npm install.
cd my-blocks
my-blocks rm -rf node_modules
➜ my-blocks npm install
npm WARN deprecated @hapi/bourne@1.3.2: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated @hapi/topo@3.1.6: This version has been deprecated and is no longer supported or maintained
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
npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm WARN deprecated @hapi/address@2.1.4: Moved to 'npm install @sideway/address'
npm WARN deprecated @hapi/hoek@8.5.1: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated @hapi/joi@15.1.1: Switch to 'npm install joi'
npm WARN deprecated core-js@2.6.12: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
added 949 packages, and audited 950 packages in 13s
40 packages are looking for funding
run npm fund for details
7 low severity vulnerabilities
To address all issues, run:
npm audit fix
Run npm audit for details.
Device information
- node v15.5.0
- npm 7.3.0
- mac os Big Sur 11.2
Description
Used
npx @wordpress/create-blockto create a block, it fails. It will create package directories undernode_modules/, but they are all empty inside.Step-by-step reproduction instructions
Just run
npx @wordpress/create-blockExpected behaviour
Creates block as per documented.
Note:
Some googling of "Error: Command failed with exit code 127" lead me to similar errors in Yarn package, where people suggesting "delete node_modules/ and do npm install again" -- this seem to solve though no sure why.
So I tried same, and this completed installation. Not sure why.
Anyhow,
npx @wordpress/create-blockshould just work.Code snippet (optional)
Below is the output doing deletion of node modules and doing npm install.
Device information