-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Closed
Labels
[Status] BlockedUsed to indicate that a current effort isn't able to move forwardUsed to indicate that a current effort isn't able to move forward[Tool] WP Scripts/packages/scripts/packages/scripts[Type] BugAn existing feature does not function as intendedAn existing feature does not function as intended
Description
Describe the bug
Error with the prettier dependency while running the lint script from @wordpress/scripts after a new npm install.
To reproduce
Steps to reproduce the behavior:
- Create a project and add the
@wordpress/scriptsdev dependency
> mkdir scripts-test \
&& cd scripts-test \
&& npm init -y && npm i -D @wordpress/scripts
- Add the script to the package.json:
"lint:js": "wp-scripts lint-js" - Create a js file and run the lint to see it is working.
> echo 'const x = 1;' >index.js \
&& npm run lint:js
- Checking the prettier dependency in this moment:
> npm ls prettier
[email protected] /Users/renatho/Downloads/scripts-test
└─┬ @wordpress/[email protected]
├─┬ @wordpress/[email protected]
│ └── prettier@npm:[email protected] deduped
└── prettier@npm:[email protected]
- You can make a
git inithere and commit thepackage-lockto see the next changes. - Remove the
node_modulesfolder, reinstall the packages and run the lint script. The new install will update (unexpectedly) ourpackage-lock.jsonand It stops to work because it doesn't find theprettier. You will see the errorError: Cannot find module 'prettier'
> rm -rf node_modules \
&& npm i \
&& npm run lint:js
- Check the prettier dependency to understand what happened (you can also see the
package-lockdiff):
> npm ls prettier
[email protected] /Users/renatho/Downloads/scripts-test
└─┬ @wordpress/[email protected]
├─┬ @wordpress/[email protected]
│ └── UNMET PEER DEPENDENCY prettier@npm:[email protected]
└── prettier@npm:[email protected]
Expected behavior
Install the @wordpress/scripts and after other npm install it continues to work properly while running the npm run lint:js.
Version (please complete the following information):
- A clean project with only the
@wordpress/scriptsinstalled. Reproduced in7.1.3and8.0.1
Desktop (please complete the following information):
- OS: macOS Catalina
- NPM 6.14.4 / Node 10.17.0
kasparsd
Metadata
Metadata
Assignees
Labels
[Status] BlockedUsed to indicate that a current effort isn't able to move forwardUsed to indicate that a current effort isn't able to move forward[Tool] WP Scripts/packages/scripts/packages/scripts[Type] BugAn existing feature does not function as intendedAn existing feature does not function as intended