Failed to load module. Attempted to load prettier from package.json
If you have this problem which was saying you “Failed to load module. Attempted to load prettier from package.json” then it’s not a big deal.
Maybe when you’re using VS Code and open up a project, you got this notification. The notification was saying that “Failed to load module. If you have prettier or plugins referenced in package.json, ensure you have runnpm installAttempted to load prettier from package.json.” and the source is Prettier Code Format. You may install an extension called Prettier Code Format and the error is from this extension.
The Solution
Step 1
Install Prettier Globally via npm if you have never installed it globally
npm i prettier -g
Step 2
Search and use the Prettier Path extension setting in your VS Code settings.
You can navigate to VS Code Settings > Extensions > Prettier
for all Prettier Extension Settings.
Read More: How to create a search bar using HTML, CSS and JavaScript
Step 3
Update the Prettier Path to your globally installed Prettier. The path will be usr/local/lib/node_modules/prettier
for MAC OS and Linux. For Windows, the path will be \AppData\Roaming\npm\node_modules\prettier
.
So, this is the whole process. By following this process your problem may need to solve. But, if it’s not working for you, you can inform me that on the comment section.