Hello, I followed the readme and tried to configure the prettier plugin globally. For this I installed prettier and prettier-plugin-javaglobally with npm -g and added the file prettierrc.yaml to the root directory with the following content as described in the readme:
plugins:
- prettier-plugin-java
When I run prettier --write "**/*.java" in the root directory I see the following error:
[error] Cannot find package 'prettier-plugin-java' imported from /Users/currentuser/projectroot/noop.js
It seems that it tries to load the plugin from the project directory and not from the global node_modules which is quite annoying. As others do not seem to have this kind of issue, this might only occur on macOS ?
When changing the plugin path in the prettierrc.yaml to an absolute path it works as expected:
plugins:
- "/Users/currentuser/.nvm/versions/node/v18.16.1/lib/node_modules/prettier-plugin-java/dist/index.js"
However, this means that the file cannot be checked into Git and every developer has to configure the file since everyone has different paths; I cannot even replace /Users/currentuser with ~ , this also throws the same error.
Do you know how I can make it work on macOS so that I can only use the short version and do not need the absolute path? If there is no way to make it work, the documentation of this project should be adjusted and this issue must be described in the readme. It took me way too long to figure out how to get rid of the error.
Hello, I followed the readme and tried to configure the prettier plugin globally. For this I installed
prettierandprettier-plugin-javaglobally withnpm -gand added the fileprettierrc.yamlto the root directory with the following content as described in the readme:When I run
prettier --write "**/*.java"in the root directory I see the following error:[error] Cannot find package 'prettier-plugin-java' imported from /Users/currentuser/projectroot/noop.jsIt seems that it tries to load the plugin from the project directory and not from the global node_modules which is quite annoying. As others do not seem to have this kind of issue, this might only occur on macOS ?
When changing the plugin path in the
prettierrc.yamlto an absolute path it works as expected:However, this means that the file cannot be checked into Git and every developer has to configure the file since everyone has different paths; I cannot even replace
/Users/currentuserwith~, this also throws the same error.Do you know how I can make it work on macOS so that I can only use the short version and do not need the absolute path? If there is no way to make it work, the documentation of this project should be adjusted and this issue must be described in the readme. It took me way too long to figure out how to get rid of the error.