Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node v10.0.0 error Found incompatible module, upath@1.0.4: The engine "node" is incompatible with this module. Expected version ">=4 <=9" #1637

Closed
1 of 7 tasks
jasdeepkhalsa opened this issue May 1, 2018 · 17 comments

Comments

@jasdeepkhalsa
Copy link

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 ( )
@jasdeepkhalsa
Copy link
Author

Looks like this issue has been addressed / fixed in facebook/create-react-app#4367

@ljharb
Copy link
Member

ljharb commented May 1, 2018

Either way, "engines" is advisory; yarn shouldn't be failing on it.

@jasdeepkhalsa
Copy link
Author

jasdeepkhalsa commented May 1, 2018

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 run yarn install or npm i again.

After doing this, the original command is now working: yarn add enzyme enzyme-adapter-react-16 --dev

@code4cake
Copy link

@jhbsk, I followed instructions but still getting the same error with yarn install it seems to be fixed when npm install is used

npm  6.1.0
node 10.3.0
yarn 1.7.0 // <= problem began after upgrading

@paneq
Copy link

paneq commented Jun 11, 2018

Instead, the proper solution is to delete node_modules/, package-lock.json & yarn.lock and run yarn install

which would lead to forgetting all the locked versions and potentially upgrading the libraries?

@kahboom
Copy link

kahboom commented Jun 14, 2018

@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.

@jasdeepkhalsa
Copy link
Author

jasdeepkhalsa commented Jun 14, 2018

Very good points @paneq & @kahboom. The problem is caused by upath v1.0.4 as a deep dependency of webpack see PR here that fixed this which has a nice dependency tree in the description.

So you might just be able to get away with updating webpack with:

yarn upgrade webpack@my.existing.version

This should cause all the dependencies to be updated, but I've not tried it so do let me know how it goes!

@paneq
Copy link

paneq commented Jun 14, 2018

@kahboom @jhbsk

Here is a trick I learned recently:

Find

upath@^1.0.0:
  version "1.0.4"
  resolved "https://registry.yarnpkg.com/upath/-/upath-1.0.4.tgz#ee2321ba0a786c50973db043a50b7bcba822361d"

in yarn.lock and remove it manually. Just these 4 lines.

Run yarn install.

Watch how only this 1 package got upgraded to:

 upath@^1.0.0:
  version "1.1.0"
  resolved "https://registry.yarnpkg.com/upath/-/upath-1.1.0.tgz#35256597e46a581db4793d0ce47fa9aebfc9fabd"

:-)

@joonhocho
Copy link

joonhocho commented Jul 22, 2018

@paneq Thanks for this. I noticed that you can also delete yarn.lock and run yarn again.

@paneq
Copy link

paneq commented Jul 22, 2018

@joonhocho Please see this comment #1637 (comment) 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 ?

@hrai
Copy link

hrai commented Sep 4, 2018

Or you can always downgrade to older version of node earlier than 9

@xctest
Copy link

xctest commented Sep 26, 2018

@paneq thanks a lot , it solves my problem

@hanneslehmann
Copy link

hanneslehmann commented Nov 26, 2018

@paneq unbelivable - you mad my day!

@kahboom @jhbsk

Here is a trick I learned recently:

Find

upath@^1.0.0:
  version "1.0.4"
  resolved "https://registry.yarnpkg.com/upath/-/upath-1.0.4.tgz#ee2321ba0a786c50973db043a50b7bcba822361d"

in yarn.lock and remove it manually. Just these 4 lines.

Run yarn install.

Watch how only this 1 package got upgraded to:

 upath@^1.0.0:
  version "1.1.0"
  resolved "https://registry.yarnpkg.com/upath/-/upath-1.1.0.tgz#35256597e46a581db4793d0ce47fa9aebfc9fabd"

:-)

@ihankhong
Copy link

@paneq thanks a lot , it solves my problem

@mschipperheyn
Copy link

mschipperheyn commented Apr 4, 2019

can't we just use package.json "resolutions": { "upath": "1.1.0" }?

yup, it works. (on yarn)

@wasiqkhan786
Copy link

@kahboom @jhbsk

Here is a trick I learned recently:

Find

upath@^1.0.0:
  version "1.0.4"
  resolved "https://registry.yarnpkg.com/upath/-/upath-1.0.4.tgz#ee2321ba0a786c50973db043a50b7bcba822361d"

in yarn.lock and remove it manually. Just these 4 lines.

Run yarn install.

Watch how only this 1 package got upgraded to:

 upath@^1.0.0:
  version "1.1.0"
  resolved "https://registry.yarnpkg.com/upath/-/upath-1.1.0.tgz#35256597e46a581db4793d0ce47fa9aebfc9fabd"

:-)

hi i am deploying on server with jenkins and i got this error.should i edit yarn.lock and commit in pipeline?

@joshu-aa
Copy link

I just updated my node.

sudo node -n g

sudo n stable

and it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests