Recently I ran into following cryptic error:
❯ yarn start
yarn run v1.22.17
$ ember serve
Cannot find module 'error/typed'
Require stack:
- /Users/michal/ember/ember-intl-changeset-validations/node_modules/body/any.js
- /Users/michal/ember/ember-intl-changeset-validations/node_modules/tiny-lr/src/server.js
- /Users/michal/ember/ember-intl-changeset-validations/node_modules/tiny-lr/src/index.js
- /Users/michal/ember/ember-intl-changeset-validations/node_modules/ember-cli/lib/tasks/server/livereload-server.js
- /Users/michal/ember/ember-intl-changeset-validations/node_modules/ember-cli/lib/tasks/server/express-server.js
- /Users/michal/ember/ember-intl-changeset-validations/node_modules/ember-cli/lib/tasks/serve.js
- /Users/michal/ember/ember-intl-changeset-validations/node_modules/ember-cli/lib/utilities/require-as-hash.js
- /Users/michal/ember/ember-intl-changeset-validations/node_modules/ember-cli/lib/cli/index.js
- /Users/michal/ember/ember-intl-changeset-validations/node_modules/ember-cli/bin/ember
Stack Trace and Error Report: /var/folders/8q/yrjx_8s115q43r8w5qd90_m00000gn/T/error.dump.05e840f2a302d50fe17fbb9a71055219.log
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
No good results on Google and weird behaviour when even rolling back to previous (working) commit did not help made me experiment and conclude that there are only two things that could help.
How to fix
Using yarn-deduplicate
Often times the cruft accumulated in yarn.lock
makes the whole project go boom. yarn-deduplicate can potentially help with this. Seen this in few instances, but(!) this did not fix the problem in my case.
❯ trash node_modules
❯ yarn global add yarn-deduplicate
❯ yarn-deduplicate
❯ yarn
❯ yarn start
yarn run v1.22.17
$ ember serve
Build successful (19933ms) – Serving on http://localhost:4200/
Regenerate yarn.lock
This method worked for me.
❯ trash node_modules
❯ trash yarn.lock
❯ yarn
❯ yarn start
yarn run v1.22.17
$ ember serve
Build successful (19933ms) – Serving on http://localhost:4200/
Notes
The trash command is an OSX utility for moving files or folder to the trash and you can replace it by calling rm -rf
.
Photo by Andrea Piacquadio from Pexels
Top comments (1)
I did not expect this article to help me so soon 🥲
-the author of the article-