Error: Cannot find module 'chalk' when using graphql-shield in production
See original GitHub issueMy Node.js app runs perfectly fine in development mode.
On running the app in production (by setting NODE_ENV
to production
or using npm install --production
), it throws the following error:
Error: Cannot find module 'chalk'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/home/example/app/node_modules/graphql-shield/dist/src/index.js:56:15)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/home/example/app/src/graphql/index.js:1:82)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
If I do just npm install
on my production server without the --production
flag, all works well but I suppose that’s not a solution since I don’t want to take up space installing devDependencies
on my production server.
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Error: Cannot find module 'chalk' when using graphql-shield in ...
My Node.js app runs perfectly fine in development mode. On running the app in production (by setting NODE_ENV to production or using npm ......
Read more >Error [ERR_MODULE_NOT_FOUND]: Cannot find module
This answer was the one that helped me! I was using import and the file was .js - Adding --es-module-specifier-resolution=node saved the day...
Read more >What does it take to support Node.js ESM? – The Guild
I have worked on all The Guild's libraries and graphql-js to support ESM. Here is how you can do it too.
Read more >vDd - River Thames Conditions - Environment Agency - GOV.UK
Russian orthodox cross symbol meaning, Module 1 bike test 2012, Quilting by the bay ... Stanage pole missing, Dubio tutissimus ibis, Lucasfan games...
Read more >Error: Cannot find module 'chalk' - ERPNext Forum
Please install yarn using below command and try again. npm install -g yarn > frappe@ production /home/frappe/frappe-bench/apps/frappe ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thank you all so much for fixing this! Great work!
Thanks for building this! 👍 : )