humm this is super weird because we can see that the string is the same so there is no reason to failā¦ the error come from the assert ā¦ ca n you try to type
assert(true);
instead of the other assert ? the only explaination i can see here is this double quoteā¦ issue or the two strings are not matching
@gabba it works now with the assert(true); ! thank you so much for helping me, I really appreciate it!
Hello @chaneltiana
assert(true) was just to test if there is no other error, but you need to test your smart contract functionality. This test is supposed to check he the message you are getting from your method is the same as the one you had set. So i think you should try again to set the message and check the return value ^^
Can you upload your file on github and share a link to me ?
I need to check this thing bugs me eheh i donāt understand
Good morning! @jon_m @chaneltiana,
I have a semi-quick question regarding this error:
[ERR_INVALID_REPL_INPUT]: Listeners for `uncaughtException` cannot be used
in the REPL
This code ran with success, prior to throwing the error.
//Unit Testing: contract HelloWorld
const HelloWorld = artifacts.require("HelloWorld");
contract("HelloWorld", async () => {
// `it` refers to the param->contract. ("HelloWorld")
it("Should initialize correctly.", async () => {
let instance = await HelloWorld.deployed();
let message = await HelloWorld.getMessage();
assert(message === "Am I what I am?!?", "Messages do not match.");
});
});
The Node docs say:
* Uncaught exceptions only emit the [`'uncaughtException'`][] event in the
standalone REPL. Adding a listener for this event in a REPL within
another Node.js program throws [`ERR_INVALID_REPL_INPUT`][].
Since thereās modules folder, is this a temporary error? Or is the a fix somewhere?
Thanks,
Brandon
Hi @chaneltiana
I have downloaded your repository and tested it , you have an error because of the string you are using
in
instance.setMessage("Hello again!", {value: 1000000, from: accounts[0]}).then(function(){
And your test is
assert(message === "Hello Again!", "Error with my message");
You are comparing āHello Again!ā and āHello again!ā the test fail because they are not equal
note the capital A in your test file
Hi @Brandon
You will find many REPL errors in this topic and ways to solve it. Which version of node truffle and npm are your running ?
So you have an message saying your message success but then this error is displayed right ?
Hey @gabba,
I have these installed:
Node v14.2.0
npm 6.14.5
Truffle v5.0.42
Truffle is the only not up to date. And yes, Success! -> error directly after. Any ideas?
omg I did not realize that small errorā¦ thank you so much for your help!
@Brandon
Can you try with node v12.16.0 ?
As the anonymous function is async it seems that you need to catch the possible errors of your function.
async () => {
Maybe the last version of node is not compatible with the spec of mocha.
If you want to keep using node 14 , try to name your function, and try to add a .then It could be possible that adding a try catch for async function is mandatory now.
usually you are calling async function this way
try{
let ret = await test();
} catch(err){
console.log(err);
}
As your callback is an anonymous async function node is maybe complaining
I never have this isse and i m not really sure about the issue to be honest
FYI: I had installed the latest version of Node LTS (12.18.0) and when I got this lesson things didnāt work. Others have run into this as well and mentioned installing 10.18.0 fixed it.
I actually installed 10.21.0 and that works as well. I have not tried anything newer.
I can not find that runner.js file on my machine. Could you tell where to find it?
I just ended up downgrading to Node 10.12.0 as pointed out by @chadrickm et. al., it was so frustrating. I did finish #defi-101-course and #defi-201 while reading about this error on github. Win-win I guess
Hi @tungtien
It depends where truffle is installed in your machine, did you install it locally or globally ? (npm i -g truffle or npm i truffle) ?
If you are on linux or mac you can run this command to check where it is installed
whereis truffle
Then you will have to go inside the truffle directory -> node_modules -> mocha -> lib -> runner.js
For example i installed truffle globally, and node is installed with nvm on my machine so the file is there
/home/gab/.nvm/versions/node/v12.18.0/lib/node_modules/truffle/node_modules/mocha/lib/runner.js
But it could be somewhere else, it depends where truffle is installed
Thank you Gabba, I could wait for your reply and already downgraded to Node 10ā¦ and it works.
Filip,
I got everything to work so far except for the test routine. Whenever I run the test command, I get the following error message:
TypeError [ERR_INVALID_REPL_INPUT]: Listeners for uncaughtException
cannot be used in the REPL
Update: I was able to resolve this issue by installing the nodist program and using the command ā$ node use 10ā but now the ganache program no longer allows me to add projects. With the version used in this course I always got the error message āDid you forget to npm install your project?ā when trying to add a profject. I then installed the most recent version of ganache, but that didnāt help either. Now I get the message " To see rich contract data compile the contracts within your Truffle Projectā¦" I have compiled and migrated everything back and forth endlessly, but I cannot get it to work.
I am pretty much completely stuck.āno longer, I finally got it to work (two days laterāno kidding). I installed the nodist program from a different source and now itās all working.
Hi @FrankB
Sorry but i donāt know nodist.
I usually recommend to install node with nvm. But you solve it so congratz