• Hello,

    I build the block like in course “Beginner WP Developer”. I scaffolded a new block with npx command: @wordpress/create-block@latest copyright-date-block. But when I type a command for build block: npm run build I have:

    ilya@ilya-MS-7B38:/opt/lampp/htdocs/wordpress/wp-content/plugins/copyright-date-block$ npm run build

    [email protected] build
    wp-scripts build

    [webpack-cli] SyntaxError: Expected double-quoted property name in JSON at position 463
    at JSON.parse ()
    at /opt/lampp/htdocs/wordpress/wp-content/plugins/copyright-date-block/node_modules/@wordpress/scripts/utils/config.js:373:26
    at Array.flatMap ()
    at getPhpFilePaths (/opt/lampp/htdocs/wordpress/wp-content/plugins/copyright-date-block/node_modules/@wordpress/scripts/utils/config.js:372:28)
    at /opt/lampp/htdocs/wordpress/wp-content/plugins/copyright-date-block/node_modules/@wordpress/scripts/utils/php-file-paths-plugin.js:52:29
    at Hook.eval [as call] (eval at create (/opt/lampp/htdocs/wordpress/wp-content/plugins/copyright-date-block/node_modules/tapable/lib/HookCodeFactory.js:19:10), :7:1)
    at Hook.CALL_DELEGATE as _call
    at Compiler.newCompilation (/opt/lampp/htdocs/wordpress/wp-content/plugins/copyright-date-block/node_modules/webpack/lib/Compiler.js:1273:30)
    at /opt/lampp/htdocs/wordpress/wp-content/plugins/copyright-date-block/node_modules/webpack/lib/Compiler.js:1318:29
    at Hook.eval [as callAsync] (eval at create (/opt/lampp/htdocs/wordpress/wp-content/plugins/copyright-date-block/node_modules/tapable/lib/HookCodeFactory.js:33:10), :6:1)

    Why is error? Thank you

Viewing 1 replies (of 1 total)
  • Hello @arakchievilya,

    From the errors you provided probably your block.json or package.json files contains invalid syntax for the property name.
    Like in .json files you need to make sure that your property name should be double-quoted for example.

    {
    name: "My block name" # This is not valid json
    "name": "My block name" # This is valid json
    }

    I would recommend you to check the block.json or package.json files for the above mistakes.

    Hope this helps!

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.