3

I am creating a react frontend that interacts with some smart contracts. However, when I run npm start to run my react application, I am getting the following error:

Failed to compile.

./node_modules/hardhat/internal/cli/ArgumentsParser.js 166:26
Module parse failed: Unexpected token (166:26)
File was processed with these loaders:
 * ./node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
|         throw new errors_1.HardhatError(errors_list_1.ERRORS.ARGUMENTS.MISSING_TASK_ARGUMENT, {      
|           param: ArgumentsParser.paramNameToCLA(paramName),
>           task: taskName ?? "help"
|         });
|       } // We only parse the arguments of non-subtasks, and those only

After doing some debugging, I noticed the error is introduced at the line in my interact.js file(the file that has all my contract interaction functions) where I import ethers from hardhat in order to do some contract interaction :

import { ethers } from 'hardhat';

Would anyone know how I can sold this problem?

2
  • how did you solve that problem ?
    – Titas Roy
    Dec 29, 2022 at 8:34
  • have you fixed?
    – John Joe
    Jan 20, 2023 at 14:41

1 Answer 1

-1

Navigate to package.json In your React project. Locate “react scripts” and change it to 4.0.1, save it and in your react project in terminal hit npm install. Restart and check npm start again. Let me know if that works.

1
  • Hello, thank you for the suggestion. I tried it out but I'm still getting the same error, any alternative you'd suggest I attempt? Nov 20, 2022 at 17:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.