AppData-Roaming-npm is empty! 'ERR_DLOPEN_FAILED' - node.js

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'
}
npm init -y
npm i --dev hardhat
npx hardhat and create a JavaScript project
npm i --dev #nomicfoundation/hardhat-toolbox
`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?

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.

Related

Internal/modules/cjs/loader.js: 584 error

I am facing an error when I am running npm commands for running a umi app project. This is the error I see when I run the code.
I have tried checking the node module for the loader.js file but I have not been able to find it.
internal/modules/cjs/loader.js:584
throw err;
^
Error: Cannot find module '#nodelib/fs.stat'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
at Function.Module._load (internal/modules/cjs/loader.js:508:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.<anonymous> (C:\Users\cyhc9\umiapp\node_modules\fast-glob\out\adapters\fs-stream.js:17:14)
at Module._compile (internal/modules/cjs/loader.js:701:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
at Module.load (internal/modules/cjs/loader.js:600:32)
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
at Function.Module._load (internal/modules/cjs/loader.js:531:3)
The code should run when I run npm commands or the project commands.
Possible solutions:
Try not to have space in your directory name, i.e.: fun project/nestjs/..., try this: fun-project/nestjs/....
Remove node_modules and package-lock.json then do npm install again to see if that solve the problem.
Clear node cache by npm cache clean --force then repeat step number 2.
Keep trying npm i again.
Buy a new computer.
Good luck.

Error: Cannot find module 'binary-extensions'

I am trying to use reactjs on local system.
I followed the official documentation of reactjs and was trying its tutorial on tic tac toe.
For local development environment I followed all the steps but when I try to run npm start I am getting below error
module.js:549
throw err;
^
Error: Cannot find module 'binary-extensions'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/home/Documents/my-
app/node_modules/chokidar/node_modules/is-binary-path/index.js:3:24)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
I am using Node v8.11.3 and npm v5.6.0
FYI I have installed binary-extensions using npm i binary-extensions but I am still getting same error.
Somehow, your project has lost track of the binary-extensions module.
The fix is simple.
In your project, delete node_modules/ and package-lock.json.
macOS / Linux:
rm -rf node_modules/
rm package-lock.json
Windows:
rmdir node_modules/
rm package-lock.json
Then,
npm install
This will resolve the issue.

NodeJS Error: Cannot find module './lib/oauth'

After cloning my test site from github and succeeding to remove the default version of node on my raspberry pi 3 and installing V8.5.0, I ran npm install and npm install nodemon -g. Now however I am unable to run my script due to an error:
module.js:529
throw err;
^
Error: Cannot find module './lib/oauth'
at Function.Module._resolveFilename (module.js:527:15)
at Function.Module._load (module.js:476:23)
at Module.require (module.js:568:17)
at require (internal/module.js:11:18)
at Object. (/home/pi/Projects/EncodedB0t/node_modules/request/request.js:28:13)
at Module._compile (module.js:624:30)
at Object.Module._extensions..js (module.js:635:10)
at Module.load (module.js:545:32)
at tryModuleLoad (module.js:508:12)
at Function.Module._load (module.js:500:3)
I've tried adding npm install oauth --save to no avail and haven't been able to find an answer online.
Any help would be appreciated!
Edit: added my github repo, https://github.com/TheWalkingM3m3/EncodedB0t
Try run npm install request --save. Then rename oauth.js.example in your root directory on oauth.js. It's works in my case.

I am not able to uninstall nodejs. After I got the error module not found "node-uuid"

I tried to install angular2 quickstart https://angular.io/docs/ts/latest/guide/setup.html#!#develop-locally Then I got the error node-uuid module not found. I tried following these links https://github.com/npm/npm/issues/15310 but its not working :( .
Error: Cannot find module 'node-uuid'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:278:25)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (\nodejs\node_modules\npm\node_modules\request\lib\auth.js:4:12)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
Please let me know how to get npm install work again.
Most NPM issues can be fixed with this process :
In your project
rm -rf /node_modules
npm cache clean
Find your global node_modules
You can run npm list -g to see where global libraries are installed.
On Unix systems they are normally placed in /usr/local/lib/node or
/usr/local/lib/node_modules when installed globally. If you set the
NODE_PATH environment variable to this path, the modules can be found
by node.
Windows XP - %USERPROFILE%\Application Data\npm\node_modules
Windows 7 [ - 10]
- %AppData%\npm\node_modules
rm -rf /node_modules
Back to your project
npm install

Getting error: Cannot find module 'errno' running node script

I've just installed a fresh copy of Ubuntu 15.10, node 4.2.2 and npm 2.14.7 (with nvm) on a new machine. I have installed webpack and webpack-dev-server globally and installed my project dependencies with npm i.
Now when I try to run my node server I get the following errors:
module.js:339
throw err;
^
Error: Cannot find module 'errno'
at Function.Module._resolveFilename (module.js:337:15)
at Function.Module._load (module.js:287:25)
at Module.require (module.js:366:17)
at require (module.js:385:17)
at Object.<anonymous> (/node_modules/webpack-dev-middleware/node_modules/memory-fs/lib/MemoryFileSystem.js:7:14)
at Module._compile (module.js:435:26)
at Object.Module._extensions..js (module.js:442:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:311:12)
at Module.require (module.js:366:17)
at require (module.js:385:17)
Any suggestions please?
Node.js searches for modules in the ./node_modules/ directory in the path where the program is.
For example if you script is here /home/user/scripts/somescript.js you should have /home/user/scripts/node_modules/.
Just do npm install errno in here /home/user/scripts/.
It seems that something had gone wrong with my npm install and my project dependencies were only partly installed. Just running npm install again didn't fix it. I did an npm cache clean, removed my node_modules directory and then ran npm install again. The problem was then resolved.

Resources