When "prettier" is in a package.json but not installed it fails
See original GitHub issueSteps to reproduce:
~/tmp/sampleproject
▶ npm install --dev prettier
npm WARN package.json sampleproject@1.0.0 No description
npm WARN package.json sampleproject@1.0.0 No repository field.
npm WARN package.json sampleproject@1.0.0 No README data
prettier@1.14.2 node_modules/prettier
~/tmp/sampleproject
▶ ./node_modules/.bin/prettier --version
1.14.2
~/tmp/sampleproject
▶ rm -fr node_modules
~/tmp/sampleproject
▶ mkdir src
~/tmp/sampleproject
▶ touch src/Foo.js
~/tmp/sampleproject
▶ code .
Error:
ERR Cannot find module 'prettier' from '/Users/peterbe/tmp/sampleproject/package.json': Error: Cannot find module 'prettier' from '/Users/peterbe/tmp/sampleproject/package.json'
Issue Analytics
- State:
- Created 5 years ago
- Reactions:7
- Comments:10 (2 by maintainers)
Top Results From Across the Web
In VS Code, I'm getting this error, 'Failed to load module ...
It seems like some path is broken on my machine or something is missing. We have a package.json with a script to run...
Read more >Cannot find module 'prettier' error | bobbyhadz
To solve the error "Cannot find module 'prettier'", make sure to install the prettier package by opening your terminal in your project's root...
Read more >Failed to load module. Attempted to load prettier from package ...
If you have prettier or plugins referenced in package.json, ensure you have runnpm installAttempted to load prettier from package.json.” and the ...
Read more >Cannot find module 'prettier' error [Solved] - Reactgo
The “Cannot find module 'prettier'” error occurs due to one of the following reasons: The module is not installed in the correct project…...
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
I have forked this repo and added a work around that makes it so if it can’t find a local prettier, it will use whatever prettier you have globally installed: https://github.com/anisjonischkeit/prettier-vscode/releases
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.