Reputation: 859
Was following this article ran the command
npm install --dev hardhat @nomicfoundation/hardhat-toolbox
got the successful response. However when I try to run the
npx hardhat
getting Unexpected token ?
response.
Tried removing the package-local.json. Also tried removing the global installation. Nothing worked.
Upvotes: 5
Views: 9583
Reputation: 1
I also got the same error when I was installing the hardhat:
let taskName = parsedTaskName ?? task_names_1.TASK_HELP;
SyntaxError: Unexpected token '?'
try this command on your terminal
nvm use 18
nvm install 18
basically above commands will increase your node.js and npm version
then try to install
npx hardhat
Upvotes: 0
Reputation: 39
I have had a similar issue attempting to install hardhat via
npx hardhat
.
I found the solution from user I Like resolved this. Make sure you are using correct version of node. try nvm use 18
nvm install 18
npx hardhat
and had success!
Upvotes: 3
Reputation: 4133
I also got the same error!
~ npx hardhat Unexpected token '?'
After i upgrade my nodejs version to v16.17.0 and npm version to 8.15.0, error is gone
Once the reported error is gone then you should see the below message
ā ~ npx hardhat
888 888 888 888 888
888 888 888 888 888
888 888 888 888 888
8888888888 8888b. 888d888 .d88888 88888b. 8888b. 888888
888 888 "88b 888P" d88" 888 888 "88b "88b 888
888 888 .d888888 888 888 888 888 888 .d888888 888
888 888 888 888 888 Y88b 888 888 888 888 888 Y88b.
888 888 "Y888888 888 "Y88888 888 888 "Y888888 "Y888
š· Welcome to Hardhat v2.11.2 š·ā
Upvotes: 6