react-storefront icon indicating copy to clipboard operation
react-storefront copied to clipboard

Web pack Error while running a npm start && npm run build command

Open gisarunpandian opened this issue 4 years ago • 3 comments

Bug report

I am using MacOs 11.2.1 and I have tried to install / run and deploy react-storefront using several methods. All have failed me.

Describe the bug

  1. I used standard MacoS NodeJS v12.18.3, NPM v6.14.6. and I ran the commands from the docs:
npm install 
npm start or npm run build

When I run npm start I am presented with the following error:

internal/modules/cjs/loader.js:968
  throw err;
  ^

Error: Cannot find module 'webpack'
Require stack:
- /Users/gis00217/Documents/my-doc/arun/myreact-app/next.config.js
- /Users/gis00217/Documents/my-doc/arun/myreact-app/node_modules/next/dist/next-server/server/config.js
- /Users/gis00217/Documents/my-doc/arun/myreact-app/node_modules/next/dist/next-server/server/next-server.js
- /Users/gis00217/Documents/my-doc/arun/myreact-app/node_modules/next/dist/server/next.js
- /Users/gis00217/Documents/my-doc/arun/myreact-app/server.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:965:15)
    at Function.Module._load (internal/modules/cjs/loader.js:841:27)
    at Module.require (internal/modules/cjs/loader.js:1025:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (/Users/gis00217/Documents/my-doc/arun/myreact-app/next.config.js:1:17)
    at Module._compile (internal/modules/cjs/loader.js:1137:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
    at Module.load (internal/modules/cjs/loader.js:985:32)
    at Function.Module._load (internal/modules/cjs/loader.js:878:14)
    at Module.require (internal/modules/cjs/loader.js:1025:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at loadConfig (/Users/gis00217/Documents/my-doc/arun/myreact-app/node_modules/next/dist/next-server/server/config.js:8:94)
    at new Server (/Users/gis00217/Documents/my-doc/arun/myreact-app/node_modules/next/dist/next-server/server/next-server.js:1:4533)
    at new DevServer (/Users/gis00217/Documents/my-doc/arun/myreact-app/node_modules/next/dist/server/next-dev-server.js:1:2964)
    at createServer (/Users/gis00217/Documents/my-doc/arun/myreact-app/node_modules/next/dist/server/next.js:2:607)
    at Object.<anonymous> (/Users/gis00217/Documents/my-doc/arun/myreact-app/server.js:14:13) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/gis00217/Documents/my-doc/arun/myreact-app/next.config.js',
    '/Users/gis00217/Documents/my-doc/arun/myreact-app/node_modules/next/dist/next-server/server/config.js',
    '/Users/gis00217/Documents/my-doc/arun/myreact-app/node_modules/next/dist/next-server/server/next-server.js',
    '/Users/gis00217/Documents/my-doc/arun/myreact-app/node_modules/next/dist/server/next.js',
    '/Users/gis00217/Documents/my-doc/arun/myreact-app/server.js'
  ]
}
[nodemon] app crashed - waiting for file changes before starting...

Expected behavior

The site is supposed to start on localhost:3000 .

Screenshots

Screenshot 2021-02-12 at 12 19 12 PM

System information

  • OS: macOS
  • Version of React Storefront: 8.0.0

Additional context

Add any other context about the problem here.

gisarunpandian avatar Feb 12 '21 07:02 gisarunpandian

I got past this by installing webpack (version 4) npm i [email protected]

chris--jones avatar Feb 16 '21 12:02 chris--jones

Facing strange issues with react-storefront, Not really as fast as they advertise. Configuration takes a ton of time. I literally spent hours trying to fix the webpack issue.

Most notorious one Next (node:80537) [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. Next (node:80537) UnhandledPromiseRejectionWarning: TypeError: Invalid value used as weak map key at WeakMap.set (<anonymous>)

NeonMando158 avatar Feb 17 '21 03:02 NeonMando158

@NeonMando158 You have to install webpack v4.

boazhoch avatar Feb 19 '21 07:02 boazhoch