Cannot find module '..\npm\node_modules\yo\lib\cli.js' - node.js

when i am trying to add endpoints using command "yo angular-fullstack:endpoint name", i am getting this error:
module.js:341
throw err;
^
Error: Cannot find module 'C:...npm\node_modules\yo\lib\cli.js'
at Function.Module._resolveFilename (module.js:339:15)
at Function.Module._load (module.js:290:25)
at Function.Module.runMain (module.js:447:10)
at startup (node.js:140:18)
at node.js:1001:3
while running command npm-install, i am getting this error
> error C2373: '__pfnDliNotifyHook2'

solved by changing the node version to a newer version

Related

pod install fails in integrated vs terminal

I'm trying to run a pod update from my integrated VS-code terminal (react-native project) but it keeps throwing this error:
node:internal/modules/cjs/loader:936 throw err; ^
Error: Cannot find module '/Users/.../App/node_modules/#react-native-community/cli/build/bin.js Debugger attached. Waiting for the debugger to disconnect...'
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47 { code: 'MODULE_NOT_FOUND', requireStack: [] }
Node.js v17.6.0
[!] Invalid `Podfile` file: 859: unexpected token at ''.
target 'appname' do
config = use_native_modules! use_react_native!(
I already tried removing package-lock.json, node_modules, and reinstalling.
If I run the command in a normal terminal I have no problems, any ideas?
Please try this:
step 1: pod deintegrate
step 2: pod install

When starting a discord bot i get this error

When starting my discord bot that I created a couple years ago I'm getting this error, I've no clue on whats causing it. I have done the uninstall of the node_modules and reinstalling etc but I'm not sure what the error could be caused by, any ideas?
Error:
PS C:\Users\Admin\Documents\Bot> node index.js
internal/modules/cjs/loader.js:960
throw err;
^
Error: Cannot find module 'better-sqlite3'
Require stack:
- C:\Users\Admin\Documents\Bot\node_modules\enmap\src\index.js
- C:\Users\Admin\Documents\Bot\node_modules\enmap\index.js
- C:\Users\Admin\Documents\Bot\index.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:957:15)
at Function.Module._load (internal/modules/cjs/loader.js:840:27)
at Module.require (internal/modules/cjs/loader.js:1019:19)
at require (internal/modules/cjs/helpers.js:77:18)
at new Enmap (C:\Users\Admin\Documents\Bot\node_modules\enmap\src\index.js:110:24)
at Object.<anonymous> (C:\Users\Admin\Documents\Bot\index.js:5:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
at Module.load (internal/modules/cjs/loader.js:977:32)
at Function.Module._load (internal/modules/cjs/loader.js:877:14) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'C:\\Users\\Admin\\Documents\\Bot\\node_modules\\enmap\\src\\index.js',
'C:\\Users\\Admin\\Documents\\Bot\\node_modules\\enmap\\index.js',
'C:\\Users\\Admin\\Documents\\Bot\\index.js'
]
}
First make sure better-sqlite3 is installed
npm i better-sqlite3
then that it has been defined
const better-sqlite3 = require('better-sqlite3')

node.js cannot find module "mongodb"

I'm trying to connect my node js file to mongodb but I keep running into this error. mongodb is in the node_modules file. I'm unsure of what Im doing wrong
node mongstuff.js
internal/modules/cjs/loader.js:670
throw err;
^
Error: Cannot find module '/home/mohammed/node_modules/mongstuff.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:668:15)
at Function.Module._load (internal/modules/cjs/loader.js:591:27)
at Function.Module.runMain (internal/modules/cjs/loader.js:877:12)
at internal/main/run_main_module.js:21:11

Can't run node.js server locally

I'd like to run node.js server on my machine but I get this error. What should I do? (Please note I'm not programmer :)
MBP-Mike:~ michal$ node server
internal/modules/cjs/loader.js:638
throw err;
^
Error: Cannot find module '/Users/michal/server'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Function.Module.runMain (internal/modules/cjs/loader.js:829:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
to run a nodejs server:
node
example: if your server file is called server.js
node /Users/Michal/server.js
it seems like you missed the .js extension on your command.
node server.js
Or you can just run
node .

Cannot find module 'install-npm-version'

I'm developing this project with TypeScript: https://github.com/scott-lin/install-npm-version
When trying to consume the package within another project, I'm getting Cannot find module 'install-npm-version' error.
Repro Steps
npm install install-npm-version#1.0.2
Create repro.js file with const inv = require('install-npm-version'); as the content
Invoke the repro with node .\repro.js
Error
> node .\repro.js
module.js:545
throw err;
^
Error: Cannot find module 'install-npm-version'
at Function.Module._resolveFilename (module.js:543:15)
at Function.Module._load (module.js:470:25)
at Module.require (module.js:593:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (C:\Users\scottlin.REDMOND\Desktop\test\repro.js:1:75)
at Module._compile (module.js:649:30)
at Object.Module._extensions..js (module.js:660:10)
at Module.load (module.js:561:32)
at tryModuleLoad (module.js:501:12)
at Function.Module._load (module.js:493:3)
PS C:\Users\scottlin.REDMOND\Desktop\test>
The main property in the package.json file is used to find the module when using as an in-code Node module. Yours starts with a slash, implying the root directory. This is incorrect, which is why your code is failing.
To fix:
Change
"main": "/lib/Install.js",
to
"main": "lib/Install.js",

Resources