0

I am trying to create a new Hardhat project. Hardhat gives me some pre-created sol files and some scripts. I am just trying to compile this pre-created project, but an error occurred.

\\?\C:\Users\myuser\Desktop\SolidityProjects\emptyhardhatfinal\node_modules\@nomicfoundation\solidity-analyzer-win32-x64-msvc\solidity-analyzer.win32-x64-msvc.node    at Object.Module._extensions..node (node:internal/modules/cjs/loader:1210:18)
    at Module.load (node:internal/modules/cjs/loader:1004:32)
    at Function.Module._load (node:internal/modules/cjs/loader:839:12)
    at Module.require (node:internal/modules/cjs/loader:1028:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (C:\Users\myuser\Desktop\SolidityProjects\emptyhardhatfinal\node_modules\@nomicfoundation\solidity-analyzer\index.js:69:29)    at Module._compile (node:internal/modules/cjs/loader:1126:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1180:10)
    at Module.load (node:internal/modules/cjs/loader:1004:32)
    at Function.Module._load (node:internal/modules/cjs/loader:839:12) {
  code: 'ERR_DLOPEN_FAILED'
}
  1. npm init -y

  2. npm i --dev hardhat

  3. npx hardhat and create a JavaScript project

  4. npm i --dev @nomicfoundation/hardhat-toolbox

  5. `npx hardhat compile``` the error above occurred.

My Node.js version is v16.17.0.

User variables for my.user = C:\Users\myuser\AppData\Roaming\npm

System variables = C:\Program Files\nodejs\

I realized that the "AppData\Roaming\npm" folder is empty. But inside another PC that this project worked well is not empty; there is a "node_modules" folder.

What is the problem and how can I solve this?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131

1 Answers1

0

Try deleting the node_modules folder and see if the project uses NPM or Yarn and run the npm i or Yarn according to it.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Muhammad Hassan
  • 424
  • 3
  • 5