webpack-cli icon indicating copy to clipboard operation
webpack-cli copied to clipboard

Error when starting webpack serve: [webpack-cli] Error: Cannot find module './compiler/[object Object].js'

Open CraigSau opened this issue 3 years ago • 1 comments

When trying to run my site locally, using the script yarn hot, the following error gets thrown at me. It was working as intended until I upgraded all of my dependencies trying to fix a problem with deploying my site.

`craigsau@Craigs-MacBook-Pro PersonalSite % yarn hot yarn run v1.22.17 $ webpack serve --open --hot --profile --progress --config=webpack.config.babel.js --env=hot [webpack-cli] Error: Cannot find module './compiler/[object Object].js' Require stack:

  • /Users/craigsau/Documents/Programming Stuff/PersonalSite/webpack.config.babel.js
  • /Users/craigsau/Documents/Programming Stuff/PersonalSite/node_modules/webpack-cli/lib/webpack-cli.js
  • /Users/craigsau/Documents/Programming Stuff/PersonalSite/node_modules/webpack-cli/lib/bootstrap.js
  • /Users/craigsau/Documents/Programming Stuff/PersonalSite/node_modules/webpack-cli/bin/cli.js
  • /Users/craigsau/Documents/Programming Stuff/PersonalSite/node_modules/webpack/bin/webpack.js at Function.Module._resolveFilename (node:internal/modules/cjs/loader:940:15) at Function.Module._load (node:internal/modules/cjs/loader:773:27) at Module.require (node:internal/modules/cjs/loader:1012:19) at require (node:internal/modules/cjs/helpers:93:18) at _default (/Users/craigsau/Documents/Programming Stuff/PersonalSite/webpack.config.babel.js:1:25) at loadConfigByPath (/Users/craigsau/Documents/Programming Stuff/PersonalSite/node_modules/webpack-cli/lib/webpack-cli.js:1747:27) at async Promise.all (index 0) at WebpackCLI.loadConfig (/Users/craigsau/Documents/Programming Stuff/PersonalSite/node_modules/webpack-cli/lib/webpack-cli.js:1765:29) at WebpackCLI.createCompiler (/Users/craigsau/Documents/Programming Stuff/PersonalSite/node_modules/webpack-cli/lib/webpack-cli.js:2187:18) at Command. (/Users/craigsau/Documents/Programming Stuff/PersonalSite/node_modules/@webpack-cli/serve/lib/index.js:106:30) { code: 'MODULE_NOT_FOUND', requireStack: [ '/Users/craigsau/Documents/Programming Stuff/PersonalSite/webpack.config.babel.js', '/Users/craigsau/Documents/Programming Stuff/PersonalSite/node_modules/webpack-cli/lib/webpack-cli.js', '/Users/craigsau/Documents/Programming Stuff/PersonalSite/node_modules/webpack-cli/lib/bootstrap.js', '/Users/craigsau/Documents/Programming Stuff/PersonalSite/node_modules/webpack-cli/bin/cli.js', '/Users/craigsau/Documents/Programming Stuff/PersonalSite/node_modules/webpack/bin/webpack.js' ] } error Command failed with exit code 2. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.`

Currently it is unable to build my project locally or for production, when previously I was able to fully build the project's frontend and backend locally, with only the production side failing.

Steps to reproduce the behavior: Simply run the script yarn hot and the error shown above gets thrown. The same error gets thrown when trying to build the backend with yarn dev

The expected behavior is that the website will be opened on localhost:8080, and the backend script will build successfully.

Please paste the results of npx webpack-cli info here, and mention other relevant information `craigsau@Craigs-MacBook-Pro PersonalSite % npx webpack-cli- info npm ERR! code E404 npm ERR! 404 Not Found - GET https://registry.npmjs.org/webpack-cli- - Not found npm ERR! 404 npm ERR! 404 'webpack-cli-@latest' is not in the npm registry. npm ERR! 404 You should bug the author to publish it (or use the name yourself!) npm ERR! 404 npm ERR! 404 Note that you can also install from a npm ERR! 404 tarball, folder, http url, or git url.

npm ERR! A complete log of this run can be found in: npm ERR! /Users/craigsau/.npm/_logs/2022-03-28T18_14_16_612Z-debug.log`

The repository I am working on is public, as this is a project for college, so you can find it here: https://github.com/CraigSau/PersonalSite/tree/v1.0.8 and the package.json here: https://github.com/CraigSau/PersonalSite/blob/v1.0.8/package.json

CraigSau avatar Mar 28 '22 18:03 CraigSau

Please provide link on configuration and plus provide babel configuration

alexander-akait avatar Mar 28 '22 19:03 alexander-akait

Closing due to inactivity. Please test with latest version and feel free to reopen if still regressions. Thanks!

alexander-akait avatar Sep 07 '22 19:09 alexander-akait