npm commands are throwing error - npm

I have installed nodejs and also have "package.json" in my application.
But every npm command is throwing following error in console:
module.js:540
throw err;
^
Error: Cannot find module 'internal/util/types'
at Function.Module._resolveFilename (module.js:538:15)
at Function.Module._load (module.js:468:25)
at Module.require (module.js:587:17)
at require (internal/module.js:11:18)
at evalmachine.<anonymous>:31:26
at Object.<anonymous> (C:\Users\SattikaA\AppData\Roaming\npm\node_modules\npm\node_modules\npm-registry-client\node_modules\graceful-fs\fs.js:11:1)
at Module._compile (module.js:643:30)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
I've tried to remove and reinstall latest nodejs version; still problem remains the same.

not load from node_module folder, it need begin with './', '../' or '/'。more detail on https://nodejs.org/api/modules.html#modules_core_modules

Related

Electron build failed

Electron build failed.
Error: Cannot find module 'fs/promises' Require stack:
/Users/abhimatta/Documents/abhishek/accura-electron-dev/node_modules/builder-util/out/fs.js
/Users/abhimatta/Documents/abhishek/accura-electron-dev/node_modules/builder-util/out/util.js
/Users/abhimatta/Documents/abhishek/accura-electron-dev/node_modules/electron-builder/out/cli/cli.js
/Users/abhimatta/Documents/abhishek/accura-electron-dev/node_modules/electron-builder/cli.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:797:15)
at Function.Module._load (internal/modules/cjs/loader.js:690:27)
at Module.require (internal/modules/cjs/loader.js:852:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object. (/Users/abhimatta/Documents/abhishek/accura-electron-dev/node_modules/builder-util/src/fs.ts:4:1)
at Module._compile (internal/modules/cjs/loader.js:959:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
at Module.load (internal/modules/cjs/loader.js:815:32)
at Function.Module._load (internal/modules/cjs/loader.js:727:14)
at Module.require (internal/modules/cjs/loader.js:852:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object. (/Users/abhimatta/Documents/abhishek/accura-electron-dev/node_modules/builder-util/src/util.ts:24:1)
at Module._compile (internal/modules/cjs/loader.js:959:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
at Module.load (internal/modules/cjs/loader.js:815:32)
at Function.Module._load (internal/modules/cjs/loader.js:727:14)
Package.json configurations
"electron": "^10.4.0",
"electron-builder": "^22.10.4",
I am trying to learn Electron. Level - zero.
I would check your node and electron versions match.
Info: https://www.electronjs.org/docs/latest/tutorial/electron-timelines
My version -- node 12.22.7 -- electron 11.5.0
I eliminated this error while learning Electron in this way:
if error: "cannot find module'fs/promises'
then
npm uninstall electron-builder
and
npm i electron-builder#22.10.5
The developers claim that this bug is indeed present in node 12
and is fixed in node 14+.

johnny-five library is not getting detected by npm

I tried installing Johnny-five library as specified in the website. After installation while running the code i am getting error as below, please help.
While installing Johnny-five package I got a message such as package-lock.json need to be committed, is it creating any issues?
D:\Js-Arduino>node servo.js
module.js:549
throw err;
^
Error: Cannot find module 'johnny-five'
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> (D:\Js-Arduino\servo.js:1:74)
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)
This issue has been resolved.
Moved nodemodules global path to Env variables and Npm started detecting it

Cannot find module './packager/babelRegisterOnly'

This error probably has to do with package manager and happens when I run react-native start
Full Error:
module.js:340
throw err;
^
Error: Cannot find module './packager/babelRegisterOnly'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:289:25)
at Module.require (module.js:366:17)
at require (module.js:385:17)
at Object.<anonymous> (/Users/amirsharif/mobile-rappad/node_modules/react-native/cli.js:11:1)
at Module._compile (module.js:425:26)
at Object.Module._extensions..js (module.js:432:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:313:12)
at Module.require (module.js:366:17)
I uninstalled react native with NPM then ran npm install react-native again and it worked. I cleared out everything in the node_modules folder.
Uninstall react-native fitst, then re-install it. It's work to me.

Error: Authentication method waterlock-local-auth could not be found.

I keep getting this error when trying sails lift even after manually running npm install waterlock-local-auth again and again
info: Starting app...
/backend-api/node_modules/waterlock/lib/methods.js:112
throw error;
^
Error: Authentication method waterlock-local-auth could not be found.
Try running npm install waterlock-local-auth
at Object._errorHandler (/backend-api/node_modules/waterlock/lib/methods.js:109:19)
at Object._handleObjects (/backend-api/node_modules/waterlock/lib/methods.js:54:14)
at Object.collect (/backend-api/node_modules/waterlock/lib/methods.js:33:19)
at new Waterlock (/backend-api/node_modules/waterlock/lib/waterlock.js:19:50)
at Object.<anonymous> (/backend-api/node_modules/waterlock/lib/index.js:8:22)
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)
at require (module.js:384:17)
at Object.<anonymous> (/backend-api/node_modules/waterlock/index.js:6:18)
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)
It ended up being bcrypt I changed the version number to 1.8.3 instead of 1.8.1
https://github.com/waterlock/waterlock-local-auth/pull/36
For
Error: Authentication method waterlock-local-auth could not be found.
Try running npm install waterlock-local-auth

Yeoman Yo WebApp Generator Issue

I am trying to generate a WebApp using Yeoman Yo Command but I keep getting following error:
pdclap-2stjvs1:ShippingSolutionPlain administrator$ yo webapp
Error: Cannot find module './lib/env'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/usr/local/lib/node_modules/generator-webapp/node_modules/yeoman-generator/index.js:7:19)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
pdclap-2stjvs1:ShippingSolutionPlain administrator$
Is it an environment variable issue?
Seems like a npm issue. Maybe it didn't copy all files or didn't install a dependency.
Install the latest version of both npm and yo, and retry.