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.

Unable to resolve custom configuration module

See original GitHub issue

Summary

It seems that version 4.0.0 released a few hours ago breaks importing/using custom Prettier configs. Downgrading to 3.20.0 fixes the issue.

I know 4.0.0 would be a breaking change, but I don’t see anything in the change logs or in the readme that indicates that custom configs would work differently…

Github Repository to Reproduce Issue

https://github.com/greenelab/prettier-config-greenelab

Steps To Reproduce:

  1. Create a new project with npm init
  2. Install this custom Prettier config with yarn add --dev git+https://git@github.com/greenelab/prettier-config-greenelab.git
  3. Create .prettierrc.yaml and put this in it: prettier-config-greenelab
  4. Install the prettier-vscode extension and try to format some javascript code with it

Expected result

The code should format with no errors in the console.

Actual result

The code does not format, and throws errors, as copy-pasted below

Additional information

Feel free to attach a screenshot.

VS Code Version: 1.43.2

Prettier Extension Version: 4.0.0

OS and version: Windows 10 64bit

Prettier Log Output

["INFO" - 11:27:07 AM] Extension Name: "prettier-vscode".
["INFO" - 11:27:07 AM] Extension Version: "4.0.0".
["INFO" - 11:27:07 AM] Enabling prettier for languages
[
  "css",
  "graphql",
  "html",
  "javascript",
  "javascriptreact",
  "json",
  "json5",
  "jsonc",
  "less",
  "markdown",
  "mdx",
  "mongo",
  "postcss",
  "scss",
  "typescript",
  "typescriptreact",
  "vue",
  "yaml"
]
["INFO" - 11:27:07 AM] Enabling prettier for range supported languages
[
  "graphql",
  "javascript",
  "javascriptreact",
  "json",
  "typescript",
  "typescriptreact"
]
["INFO" - 11:27:08 AM] Formatting c:\Users\Vincent\Desktop\adage-frontend\src\pages\signatures\participating\index.js
["ERROR" - 11:27:08 AM] Invalid prettier configuration file detected.
["ERROR" - 11:27:08 AM] Cannot find module 'prettier-config-greenelab' from 'c:\Users\Vincent\Desktop\adage-frontend'
Error: Cannot find module 'prettier-config-greenelab' from 'c:\Users\Vincent\Desktop\adage-frontend'
	at Function.Module._resolveFilename (internal/modules/cjs/loader.js:717:15)
	at Function.n.resolve (c:\Program Files\Microsoft VS Code\resources\app\out\vs\loader.js:15:584)
	at Object.transform (c:\Users\Vincent\.vscode\extensions\esbenp.prettier-vscode-4.0.0\node_modules\prettier\index.js:23283:40)
	at run (c:\Users\Vincent\.vscode\extensions\esbenp.prettier-vscode-4.0.0\node_modules\prettier\third-party.js:11472:51)
	at async cacheWrapper (c:\Users\Vincent\.vscode\extensions\esbenp.prettier-vscode-4.0.0\node_modules\prettier\third-party.js:11300:20)
	at async cacheWrapper (c:\Users\Vincent\.vscode\extensions\esbenp.prettier-vscode-4.0.0\node_modules\prettier\third-party.js:11300:20)
	at async cacheWrapper (c:\Users\Vincent\.vscode\extensions\esbenp.prettier-vscode-4.0.0\node_modules\prettier\third-party.js:11300:20)
	at async cacheWrapper (c:\Users\Vincent\.vscode\extensions\esbenp.prettier-vscode-4.0.0\node_modules\prettier\third-party.js:11300:20)
	at async cacheWrapper (c:\Users\Vincent\.vscode\extensions\esbenp.prettier-vscode-4.0.0\node_modules\prettier\third-party.js:11300:20)
	at async Explorer.search (c:\Users\Vincent\.vscode\extensions\esbenp.prettier-vscode-4.0.0\node_modules\prettier\third-party.js:11457:22)
	at async Promise.all (index 0)

Note that node_modules/prettier-config-greenelab DOES exist in my project. Everything has been installed correctly. I also have a eslint-config-greenelab installed in the same project as well, which works with no problems. And as I said, downgrading prettier-vscode in-situ, while in the same project, works.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:32
  • Comments:15 (9 by maintainers)

github_iconTop GitHub Comments

7reactions
ntottencommented, Apr 6, 2020

Issue fixed in version 4.1.1 published which has prettier 2.0.4. Thanks for the rapid fix @thorn0!

7reactions
thorn0commented, Apr 5, 2020

@ntotten Prettier 2.0.3 is out.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to resolve artifacts defined in a custom configuration
I am trying to create my own configuration from within a plugin, like this Configuration configuration = project.getConfigurations().add("servicebuilder") ...
Read more >
NestJS - can't resolve ConfigService - Stack Overflow
I am using NestJS jwt passport to auth user. I follow the doc, here is my app module:
Read more >
Configure custom modules resolve folder
The problem is that Webstorm is unable to resolve a path `components/Awesome`, because he is looking only inside `node_modules` and doesn't know ...
Read more >
IntelliJ – Cannot Resolve Spring Boot Configuration ...
In this short tutorial, we'll look at how to expose these properties to IntelliJ to make the development process easier. 2. Custom Properties....
Read more >
Troubleshooting | React Navigation
I'm getting an error "Unable to resolve module" after updating to the latest ... This can happen if you have a custom configuration...
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