Shivam Sahil
Shivam Sahil

Reputation: 4925

Unable to run deploy for hardhat: import "@nomicfoundation/hardhat-toolbox"; SyntaxError: Cannot use import statement outside a module

I have folder structure like this:

- hardhat.config.ts
- src
---- scripts
---- contracts
---- ...
...

However when I do: npx hardhat node I get the error: SyntaxError: Cannot use import statement outside a module.

Here's my tsconfig file:

{
  "compilerOptions": {
    "target": "es5",
    "lib": ["dom", "dom.iterable", "esnext"],
    "allowJs": true,
    "skipLibCheck": true,
    "strict": true,
    "forceConsistentCasingInFileNames": true,
    "noEmit": true,
    "esModuleInterop": true,
    "module": "esnext",
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "jsx": "preserve",
    "incremental": true,
    "plugins": [
      {
        "name": "next"
      }
    ],
    "baseUrl": ".",
    "paths": {
      "@@/*": ["./src/*"],
      "@@/components/*": ["./src/app/components/*"]
    },
  },
  "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
  "exclude": ["node_modules"]
}

Note that I purposely made @/ to @@/ thinking if this maybe messing things up but that didn't seem to solve the issue either.

Upvotes: 1

Views: 97

Answers (0)

Related Questions