question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

When "prettier" is in a package.json but not installed it fails

See original GitHub issue

Steps 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'
screen shot 2018-09-05 at 9 38 25 am

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:7
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
anisjonischkeitcommented, Dec 18, 2018

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

0reactions
github-actions[bot]commented, Apr 12, 2020

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.

Read more comments on GitHub >

github_iconTop 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 >
Install - Prettier
First, install Prettier locally:
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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found