enzyme: Node v10.0.0 error Found incompatible module, upath@1.0.4: The engine "node" is incompatible with this module. Expected version ">=4 <=9"
Current behavior
Trying to install enzyme with the command yarn add enzyme enzyme-adapter-react-16 --dev
fails in my environment with the following error:
(node:88766) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
[1/4] š Resolving packages...
warning enzyme > rst-selector-parser > nearley > nomnom@1.6.2: Package no longer supported. Contact support@npmjs.com for more info.
[2/4] š Fetching packages...
error upath@1.0.4: The engine "node" is incompatible with this module. Expected version ">=4 <=9".
error Found incompatible module
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
The deprecation warning is a separate / unrelated issue which started recently after upgrading to Yarn v1.6.0.
Expected behavior
Should be able to install enzyme with enzyme-adapter-react-16 successfully
Your environment
- React v16.3.2
- Node v10.0.0
- NPM v5.6.0
- Yarn v1.6.0
Version
library | version |
---|---|
Enzyme | Latest |
React | Latest / v16.3.2 |
Adapter
- enzyme-adapter-react-16
- enzyme-adapter-react-15
- enzyme-adapter-react-15.4
- enzyme-adapter-react-14
- enzyme-adapter-react-13
- enzyme-adapter-react-helper
- others ( )
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 17 (1 by maintainers)
@kahboom @jhbsk
Here is a trick I learned recently:
Find
in
yarn.lock
and remove it manually. Just these 4 lines.Run
yarn install
.Watch how only this 1 package got upgraded to:
š
Yep, I didnāt want to use āenginesā - thatās just a messy workaround.
Instead, the proper solution is to delete
node_modules/
,package-lock.json
&yarn.lock
and runyarn install
ornpm i
again.After doing this, the original command is now working:
yarn add enzyme enzyme-adapter-react-16 --dev
Or you can always downgrade to older version of node earlier than 9
@paneq - exactly; itās not a viable solution for me, as I work with a large team and we canāt just be deleting the
yarn.lock
file on a whim.canāt we just use
package.json
"resolutions": { "upath": "1.1.0" }
?yup, it works. (on yarn)
which would lead to forgetting all the locked versions and potentially upgrading the libraries?
@joonhocho Please see this comment https://github.com/airbnb/enzyme/issues/1637#issuecomment-396141921 and try to recall why we use yarn and yarn.lock in the first place? Perhaps to remember all locked versions of packages which get lost when you remove yarn.lock ?
@paneq Thanks for this. I noticed that you can also delete yarn.lock and run yarn again.