Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Import fails on MacOS with Node 12 #425

Closed
markspanbroek opened this issue May 20, 2019 · 11 comments
Closed

Import fails on MacOS with Node 12 #425

markspanbroek opened this issue May 20, 2019 · 11 comments

Comments

@markspanbroek
Copy link
Contributor

markspanbroek commented May 20, 2019

I'm unable to use ganache-core on MacOS with Node 12. I seem to have hit a combination of #297 (optional depencency on scrypt is not so optional) and barrysteyn/node-scrypt#192 (scrypt doesn't and will never work on MacOS and Node 12).

Expected Behavior

When I import ganache-core, I expect no errors.

Current Behavior

I see the following error:

Error: Cannot find module 'scrypt'
Require stack:
- /Users/mark/Development/ganache-core/node_modules/web3-eth-accounts/node_modules/scrypt.js/node.js
- /Users/mark/Development/ganache-core/node_modules/web3-eth-accounts/src/index.js
- /Users/mark/Development/ganache-core/node_modules/web3-eth/src/index.js
- /Users/mark/Development/ganache-core/build/ganache.core.node.js
- /Users/mark/Development/ganache-core/index.js
etc..

Possible Solution

Updating ethereumjs-wallet and web3 to the latest versions should remove the dependency on scrypt.

Steps to Reproduce (for bugs)

Luckily the problem also manifests itself when running the unit tests of ganache-core, so the steps to reproduce are simple:

  1. Checkout ganache-core on a Mac with Node 12
  2. yarn
  3. yarn build
  4. yarn test

Context

I use ganache-core as a web3 provider in Truffle for testing.

Your Environment

@davidmurdoch
Copy link
Member

Thanks for this! These abandoned native transitive deps have been quite the headache for many projects here at Truffle!

@adrianmcli
Copy link
Contributor

adrianmcli commented Jun 10, 2019

@markspanbroek Are you sure that upgrading ethereumjs-wallet to the latest version will remove the dependency on Scrypt? Because I see that they still list Scrypt.js as a dependency: https://github.com/ethereumjs/ethereumjs-wallet/blob/master/package.json#L46

Web3.js is also still dependent on Scrypt.js: https://github.com/ethereum/web3.js/blob/1.0/packages/web3-eth-accounts/package.json#L25

But you are right that both of the packages use Scryot.js 0.3.0 which marks Scrypt as an optional dependency. I'm not sure how this affects how it works with Node 12 though.

@markspanbroek
Copy link
Contributor Author

@adrianmcli that's it exactly. Updating to scrypt.js 0.3.0 marks the native scrypt dependency as optional. With Node 12.1.0 the native scrypt doesn't compile, but as long as it's optional that doesn't matter.

@adrianmcli
Copy link
Contributor

@markspanbroek noted, I'll bring this up to the team and hopefully @davidmurdoch can prioritize this.

@nicholasjpaterno
Copy link
Contributor

@markspanbroek This should be fixed in ganache-core v2.5.7 although it was absent from the release notes (fixed now). Can you test it out and reopen this issue if it still doesn't work?

@markspanbroek
Copy link
Contributor Author

Thanks! Works like a charm.

@liamzebedee
Copy link

Still getting errors on ganache-cli, since it has a devDep on "scrypt": "6.0.3",. Ideas?

@davidmurdoch
Copy link
Member

@liamzebedee, we don't currently develop ganache-core or ganache-cli using node 12 currently. If you want to work on ganache-cli or ganache-core itself use node v10 or v8. Otehrwise npm install ganache-cli@latest -g or npm install ganache-core@latest shouldn't fail on node 12 though.

@liamzebedee
Copy link

@davidmurdoch ganache-cli still has a devDependency on scrypt, so it doesn't work with node 12 unfortunately.

@davidmurdoch
Copy link
Member

@liamzebedee. Yes, but because it is a devDependency it won't be installed when you run npm install ganache-cli -g. Are you experiencing otherwise?

@cruzdanilo
Copy link

the latest version of ethereumjs-wallet fixes this problem.

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

No branches or pull requests

6 participants