Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
362 views
in Technique[技术] by (71.8m points)

reactjs - Webpack cannot find module after updating package

All I did was change one package version manually in my package.json file and then npm install and now when I run the webpack-dev-server I get an error saying "uncaught Error: Cannot find module relative path at webpackMissingModule"

What I've tried:

  • rm -rf node_modules then npm install
  • npm clear cache --force
  • revert changes going back to the original package version
  • del package.lock.json then npm install --package-lock-only

None of these solutions worked and the package was working before I changed the version number.

Here is the full error thrown

Uncaught Error: Cannot find module '../../../src/Utils/BaseStyles'
    at webpackMissingModule (Card.js:43)
    at Object../node_modules/X (Card.js:43)
    at __webpack_require__ (bootstrap:789)
    at fn (bootstrap:100)
    at Object../node_modules/X (index.js:26)
    at __webpack_require__ (bootstrap:789)
    at fn (bootstrap:100)
    at Object../node_modules/X (index.js:26)
    at __webpack_require__ (bootstrap:789)
    at fn (bootstrap:100)
``
question from:https://stackoverflow.com/questions/65602967/webpack-cannot-find-module-after-updating-package

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Try following steps

  1. Remove package.json.lock file from folder where your angular project is
  2. Install angular cli lib by running npm install -g @angular/cli
  3. Remove node_modules folder and install npm packages by running npm install
  4. Rebuild node-sass binary by running npm rebuild node-sass
  5. Run project with command ng serve -o

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...