• Hi, I was hoping someone could help me with this puzzle. I’m completely new to wp-scripts. So what I did:

    1. Cloned the gutenberg wordpress project from https://github.com/WordPress/gutenberg

    2. Changed directory to packages/scripts

    3. npm install

    4. Then I tried to run bin/wp-scripts.js

    Problem is that it’s failing with [webpack-cli] Error: Cannot find module ‘webpack’
    Even though it’s installed and npm ls shows
    └── [email protected].3

    Think I’m missing some pretty basic here as I’m scratching my head. Can someone a bit more familiar with wp-scripts please let me know. What I try to is to link it and run it locally in one of my projects.

    Thanks!

    Here is the full error message:

    ? scripts git:(trunk) ? bin/wp-scripts.js start
    [webpack-cli] Failed to load ‘/home/user/proj/gutenberg/packages/scripts/config/webpack.config.js’ config
    [webpack-cli] Error: Cannot find module ‘webpack’
    Require stack:

    • /home/user/proj/gutenberg/packages/dependency-extraction-webpack-plugin/lib/index.js
    • /home/user/proj/gutenberg/packages/scripts/config/webpack.config.js
    • /home/user/proj/gutenberg/packages/scripts/node_modules/webpack-cli/lib/webpack-cli.js
    • /home/user/proj/gutenberg/packages/scripts/node_modules/webpack-cli/lib/bootstrap.js
    • /home/user/proj/gutenberg/packages/scripts/node_modules/webpack-cli/bin/cli.js
    • /home/user/proj/gutenberg/packages/scripts/node_modules/webpack/bin/webpack.js
      at Module._resolveFilename (node:internal/modules/cjs/loader:1134:15)
      at Module._load (node:internal/modules/cjs/loader:975:27)
      at Module.require (node:internal/modules/cjs/loader:1225:19)
      at require (node:internal/modules/helpers:177:18)
      at Object. (/home/user/proj/gutenberg/packages/dependency-extraction-webpack-plugin/lib/index.js:5:17)
      at Module._compile (node:internal/modules/cjs/loader:1356:14)
      at Module._extensions..js (node:internal/modules/cjs/loader:1414:10)
      at Module.load (node:internal/modules/cjs/loader:1197:32)
      at Module._load (node:internal/modules/cjs/loader:1013:12)
      at Module.require (node:internal/modules/cjs/loader:1225:19) {
      code: ‘MODULE_NOT_FOUND’,
      requireStack: [
      ‘/home/user/proj/gutenberg/packages/dependency-extraction-webpack-plugin/lib/index.js’,
      ‘/home/user/proj/gutenberg/packages/scripts/config/webpack.config.js’,
      ‘/home/user/proj/gutenberg/packages/scripts/node_modules/webpack-cli/lib/webpack-cli.js’,
      ‘/home/user/proj/gutenberg/packages/scripts/node_modules/webpack-cli/lib/bootstrap.js’,
      ‘/home/user/proj/gutenberg/packages/scripts/node_modules/webpack-cli/bin/cli.js’,
      ‘/home/user/proj/gutenberg/packages/scripts/node_modules/webpack/bin/webpack.js’
      ]
      }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Running wp-scripts locally — Can’t find webpack’ is closed to new replies.