Truffle and its sub-packages (truffle-contract) are unusable on Node.js 12.
This needs to be fixed quickly because it currently makes any package that uses truffle-contract unusable on Node.js 12.
Node.js 12 removed some deprecated functions from the V8 add-on API which are used by some of Truffle dependencies.
One of that dependencies is [email protected] which is used by eth-lib#keccakjs. To fix this, you need to update all dependencies yarn.lock. This should install [email protected] which has fixed compatibility with Node.js 12.
Another dependency with problems is [email protected] which is used by web3#web3-eth#web3-eth-accounts. It was fixed in [email protected]. Problem with this is that the fixed version is used only in [email protected] which is incompatible with Truffle (#1690). To fix this, you need to update Truffle to support [email protected] which will use the fixed version of scrypt.js.
Maybe there are also some other broken dependencies.
Error with sha3:
https://travis-ci.com/filips123/truffle/jobs/204732468
Error with scrypt:
https://travis-ci.com/filips123/EthAvatar.JS/jobs/204728583
Hey @filips123, thanks for bringing this up. This incompatibility is a known issue but unfortunately it's not something we can "fix quickly".
Firstly, upgrading to Web3.js v1.0.0-beta.55 is not an option, since there are breaking changes that would have to wait until Truffle v6. This upgrade has been something we've been attempting for at least 6 months, without success. I won't say more now, but expect an announcement soon about Web3.js versioning. A number of projects having been working with Web3.js directly and we are in the process of outlining a path forward here.
As for the sha3 issue, we can look into upgrading that; this may be more feasible. Feel free to open a pull request if you have a clear understanding of the work entailed.
Sorry about this. I understand it's frustrating—Node v12 has lots of features that I can't wait to get my hands on! Please bear with us and the rest of the community as we seek to address the limitations preventing this from working (or please help if you can!)
@gnidan I created PR #2071 that upgrade dependencies. This should fix the issue with sha3 but scrypt still needs to be fixed.
And you can also see my Travis CI build with updated dependencies:
https://travis-ci.com/filips123/truffle/jobs/204809466
Given that this is a known problem and looks like it will take some time to fix, it would be very helpful to document the problem in the Truffle installation instructions page.
Another issue regarding Node 12 (reproduction on clean project):
$ truffle init
$ truffle develop
truffle(develop)> test
Compiling your contracts...
===========================
> Compiling ./contracts/Migrations.sol
> Artifacts written to /tmp/test-119514-22057-6jhhyg.j89hi
> Compiled successfully using:
- solc: 0.5.8+commit.23d335f2.Emscripten.clang
TypeError [ERR_INVALID_REPL_INPUT] [ERR_INVALID_REPL_INPUT]: Listeners for `uncaughtException` cannot be used in the REPL
at process.<anonymous> (repl.js:224:15)
at process.emit (events.js:205:15)
at process.emit (/home/user/.nvm/versions/node/v12.4.0/lib/node_modules/truffle/build/webpack:/~/source-map-support/source-map-support.js:465:1)
at _addListener (events.js:226:14)
at process.addListener (events.js:274:10)
at Runner.run (/home/user/.nvm/versions/node/v12.4.0/lib/node_modules/truffle/node_modules/mocha/lib/runner.js:846:11)
at Mocha.run (/home/user/.nvm/versions/node/v12.4.0/lib/node_modules/truffle/node_modules/mocha/lib/mocha.js:572:17)
at /home/user/.nvm/versions/node/v12.4.0/lib/node_modules/truffle/build/webpack:/packages/truffle-core/lib/test.js:134:1
at processTicksAndRejections (internal/process/task_queues.js:89:5)
If using 11.x test command is ok.
I'm using truffle-hdwallet-provider on Node.js 12, and same errors with scrypt as shown in the logs from CI above.
A quick solution is to use Yarn resolutions which should force correct new version. Note that it is only supported in Yarn (not NPM) and it will still produce error output (but it won't fail installation).
You need to add this to package.json:
{
"resolutions": {
"eth-lib/keccakjs/sha3": "^1.2.3",
"web3/web3-eth/web3-eth-accounts/scrypt.js": "^0.3.0"
}
}
This will probably be fixed in next version of Web3.
With the announcement of Web3 versioning, is there more that can now be said about node 12 support?
I was just going to inquire, @DavidBurela. I'll dig in and see what I can find.
We're actively working on it. I believe ethereumjs-vm is the last piece of the puzzle.
Can y'all try v5.0.34 to confirm working Node v12 support?
I still have issues.
Truffle v5.0.34 (core: 5.0.34)
Solidity v0.5.8 (solc-js)
Node v12.10.0
Web3.js v1.2.1
Repo steps:
truffle unbox metacaoin
truffle dev
test
truffle(develop)> test
Compiling your contracts...
===========================
> Compiling ./contracts/ConvertLib.sol
> Compiling ./contracts/MetaCoin.sol
> Compiling ./contracts/Migrations.sol
> Compiling ./test/TestMetaCoin.sol
TypeError [ERR_INVALID_REPL_INPUT]: Listeners for `uncaughtException` cannot be used in the REPL
at process.<anonymous> (repl.js:224:15)
at process.emit (events.js:214:15)
at process.emit (/home/david/.nvm/versions/node/v12.10.0/lib/node_modules/truffle/build/webpack:/~/source-map-support/source-map-support.js:465:1)
at _addListener (events.js:235:14)
at process.addListener (events.js:283:10)
at Runner.run (/home/david/.nvm/versions/node/v12.10.0/lib/node_modules/truffle/node_modules/mocha/lib/runner.js:868:11)
at Mocha.run (/home/david/.nvm/versions/node/v12.10.0/lib/node_modules/truffle/node_modules/mocha/lib/mocha.js:612:17)
at /home/david/.nvm/versions/node/v12.10.0/lib/node_modules/truffle/build/webpack:/packages/truffle-core/lib/test.js:116:1
at new Promise (<anonymous>)
at Object.run (/home/david/.nvm/versions/node/v12.10.0/lib/node_modules/truffle/build/webpack:/packages/truffle-core/lib/test.js:115:1) at processTicksAndRejections (internal/process/task_queues.js:93:5)
Currently working in Windows 10 - reloading node.js via .msi installer worked. https://nodejs.org/en/download/
Current specs:
Truffle 5.0.40
Node: 10.16.3
NPM 6.9.0
Status update: web3 supporting node 12 is a great step forward, but we still cannot use node 12 in our project because of @truffle/[email protected] depending on [email protected]
Looks like ethereumjs-wallet being dependent to scrypt.js is the issue here
I still have issues.
Truffle v5.0.34 (core: 5.0.34)
Solidity v0.5.8 (solc-js)
Node v12.10.0
Web3.js v1.2.1Repo steps:
truffle unbox metacaoin truffle dev test truffle(develop)> test Compiling your contracts... =========================== > Compiling ./contracts/ConvertLib.sol > Compiling ./contracts/MetaCoin.sol > Compiling ./contracts/Migrations.sol > Compiling ./test/TestMetaCoin.sol TypeError [ERR_INVALID_REPL_INPUT]: Listeners for `uncaughtException` cannot be used in the REPL at process.<anonymous> (repl.js:224:15) at process.emit (events.js:214:15) at process.emit (/home/david/.nvm/versions/node/v12.10.0/lib/node_modules/truffle/build/webpack:/~/source-map-support/source-map-support.js:465:1) at _addListener (events.js:235:14) at process.addListener (events.js:283:10) at Runner.run (/home/david/.nvm/versions/node/v12.10.0/lib/node_modules/truffle/node_modules/mocha/lib/runner.js:868:11) at Mocha.run (/home/david/.nvm/versions/node/v12.10.0/lib/node_modules/truffle/node_modules/mocha/lib/mocha.js:612:17) at /home/david/.nvm/versions/node/v12.10.0/lib/node_modules/truffle/build/webpack:/packages/truffle-core/lib/test.js:116:1 at new Promise (<anonymous>) at Object.run (/home/david/.nvm/versions/node/v12.10.0/lib/node_modules/truffle/build/webpack:/packages/truffle-core/lib/test.js:115:1) at processTicksAndRejections (internal/process/task_queues.js:93:5)
yep same result here on as David B.. Im on ubuntu1604
all other parts of the suite work ok if on node v12+ ? i want to drizzle.. the tests i can do in remix on its in memory chain
johnda@ymirjda:~$ truffle version
Truffle v5.1.0 (core: 5.1.0)
Solidity v0.5.12 (solc-js)
Node v12.8.0
Web3.js v1.2.2
johnda@ymirjda:~$ "
Same issue, easiest way out of this issue is to install node v11.15.0. As node v12 and v13 both will encounter the issue.
This is not a solution, but a workaround while this is being fixed:
$ nvm install 10 --ltsThe above will install node v10 long-term support
Now you can successfully run
$ truffle develop
> compile
> test
Hope it helps!
thanks we use v10 node now...
John D Allen.
*Leveridge Systems INC. *
T +1 417 849 0705 * CST | john.[email protected]
john.allen@leveridgesystems.com | https://www.leveridgesystems.com
https://www.leveridgesystems.com | linkedin.com/in/johndallen1
http://linkedin.com/in/johndallen1 | skype john.allen_67
https://www.yourhashgraphtoken.com https://www.yourhashgraphtoken.com*
This email is sent on behalf of Leveridge Systems INC. Reg.Ein 86-0905636.
Reg Missouri Charter #01082460.
The information contained in this email and any attached files is
confidential and intended solely for the addressee(s). The email may be
legally privileged or prohibited from disclosure and unauthorized use. If
you are not the named addressee you may not use, copy, or disclose this
information to any other person. If you received this message in error
please notify the sender immediately and delete it from your system.
On Wed, Dec 4, 2019 at 12:57 AM Salvador Guerrero notifications@github.com
wrote:
This is not a solution, but a workaround while this is being fixed:
- Uninstall node
- Install nvm https://github.com/nvm-sh/nvm
- Install node v10 LTS by running: $ nvm install 10 --lts
The above will install node v10 long-term support
Now you can successfully run
$ truffle develop
compile
testHope it helps!
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/trufflesuite/truffle/issues/2070?email_source=notifications&email_token=ADGDUXNQPIHXNSPKAXVZTLTQW5IEHA5CNFSM4HSCUWOKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEF36IOI#issuecomment-561505337,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ADGDUXNRQM63SFWWEVBX4PDQW5IEHANCNFSM4HSCUWOA
.
What are the steps remaining to make this work on Node v12 (which is now also on LTS)?
@adrianmcli see mochajs/mocha#4009.
Don't have the bandwidth currently to do so myself, but feel free to smoke test my fork of mocha (https://github.com/CruzMolina/mocha/tree/v5.2.1) with truffle bundled.
Is there any progress to make this work on Node v12 (which is currently on LTS)?
Idk. I went back to 10
On Mon, Jan 6, 2020, 2:54 PM EL Yusubov notifications@github.com wrote:
Is there any progress to make this work on Node v12 (which is currently on
LTS)?—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/trufflesuite/truffle/issues/2070?email_source=notifications&email_token=ADGDUXIT4GMKA44RUMTFSYLQ4OK7ZA5CNFSM4HSCUWOKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEIGX7KA#issuecomment-571309992,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ADGDUXKYMG6LJFPH2JKN3ETQ4OK7ZANCNFSM4HSCUWOA
.
Hey everyone! ✋
We just published an experimental prerelease that uses a fork of mocha with one tiny change. 🤞
Our node 12 CI appears to be pleased and smoke testing locally w/ node 12 LTS seems to be fine.
Please give it a try and let us know if things work!
npm un -g truffle
npm i -g truffle@nodeLTS
Thanks for the lifesaver @CruzMolina, reporting success over here too!
Hey everyone! ✋
We just published an experimental prerelease that uses a fork of mocha with one tiny change. 🤞
Our node 12 CI appears to be pleased and smoke testing locally w/ node 12 LTS seems to be fine.
Please give it a try and let us know if things work!
npm un -g truffle npm i -g truffle@nodeLTS
Hey @CruzMolina can you plz help me with that? I have installed nodejs 12.14.1 ... how can I apply your solution? thx
Hi @jeffor12 !
You should be able to re-install the nodeLTS compatible (🤞) version of truffle via:
npm un -g truffle
npm i -g truffle@nodeLTS
You can verify the nodeLTS release of truffle is node 12 compatible by running:
truffle unbox metacoin
truffle develop
develop> test
If the test run completes without throwing an error, you should be good to go.
Hi @CruzMolina!
I found a solution for my test error:
TypeError [ERR_INVALID_REPL_INPUT]: Listeners for uncaughtException cannot be used in the REPL
I had to downgrade to node 10.18.1. then all went well...
Hey @jeffor12 ,
are you confirming that truffle@nodeLTS still throws that error?
Can you share your truffle version?
right now its
Truffle v5.1.11 (core: 5.1.11)
Solidity - 0.5.12 (solc-js)
Node v10.18.1
Web3.js v1.2.1
@jeffor12 , it sounds like you have truffle latest installed.
You'll need to npm un -g truffle && npm i -g truffle@nodeLTS to use truffle on node 12.
@CruzMolina thanks, that worked !
but why is the nodeLTS version not the default one? ... why are there two different versions?
Will this be fixed? Seems like a major issue.
Workaround does fix it for me.
go back to node 10
John D Allen.
T +1 417 849 0705 * CST | john.[email protected]
john.allen@leveridgesystems.com | https://www.leveridgesystems.com
https://www.leveridgesystems.com | linkedin.com/in/johndallen1
http://linkedin.com/in/johndallen1 | skype john.allen_67
https://www.yourhashgraphtoken.com https://www.yourhashgraphtoken.com*
Leveridge Systems INC. Reg Missouri Charter #01082460. The information
contained in this email and any attached files is confidential and intended
solely for the addressee(s). The email may be legally privileged or
prohibited from disclosure and unauthorized use. If you are not the
named addressee you may not use, copy, or disclose this information to any
other person. If you received this message in error please notify the
sender immediately and permanently delete it from your system.
On Fri, Mar 6, 2020 at 5:08 PM pdlla notifications@github.com wrote:
Will this be fixed? Seems like a major issue.
Workaround does fix it for me.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/trufflesuite/truffle/issues/2070?email_source=notifications&email_token=ADGDUXMHUQDM565U6DCZEP3RGF7AJA5CNFSM4HSCUWOKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEODEPLA#issuecomment-596002732,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ADGDUXJSM7QXPJTLMB5COETRGF7AJANCNFSM4HSCUWOA
.
This was a great and informative thread that helped me quickly understand my problem and find a resolution. My thanks to everyone involved.
I've tried:
npm un -g truffle
npm i -g truffle@nodeLTS
and have the following:
Truffle v5.1.14-nodeLTS.0 (core: 5.1.13)
Solidity - 0.5.0 (solc-js)
Node v13.12.0
Web3.js v1.2.1
but am still experiencing the error:
TypeError [ERR_INVALID_REPL_INPUT]: Listeners for
uncaughtExceptioncannot be used in the REPL
Hey @CruzMolina!
Thanks! It worked here like a charm :)
@CruzMolina
Thx, fixed the problem for me, too.
@CruzMolina
I also gets compilation error:
TypeError: Error parsing C:/Users/.../contracts/Migrations.sol: Cannot destructure property 'body' of 'undefined' as it is undefined.
@RLNYC: That seems like an unrelated error. Would you mind opening a new issue and elaborating on it there? Thanks!
Meanwhile, I'm going to close this issue as it should be resolved.
Most helpful comment
Hey everyone! ✋
We just published an experimental prerelease that uses a fork of mocha with one tiny change. 🤞
Our node 12 CI appears to be pleased and smoke testing locally w/ node 12 LTS seems to be fine.
Please give it a try and let us know if things work!