Cannot find module 'generator-jhipster' - node.js

I am trying to load the "generator-jhipster' inside Yeoman as is described on the Yeoman documentation:
http://yeoman.io/authoring/integrating-yeoman.html
var yeoman = require('yeoman-environment');
env.register(require.resolve('generator-jhipster'), 'jhipster:app');
The "generator-jhipster' and "generator-jhipster-entity-audit" modules are installed in node and in the app, in fact, I can use the "generator-jhipster" from the "yo "command without problems, but when I run my node Script, it give me the error:
module.js:549
throw err;
^
Error: Cannot find module 'generator-jhipster'
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> (C:\DANI\Randoop\JHIPSTER\server.js:6:16)
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)
Any idea about how to solve this error?

Solved.
The jHipster genetator don't have the index.js on the main folder, so, the correct code to invoke it is:
var yeoman = require('yeoman-environment');
var env = yeoman.createEnv();
env.register(require.resolve('generator-jhipster/generators/app'), 'jhipster:app');

Related

Cannot find module 'map-cache'

When I gulp serve my SPFx Webpart getting this error, also when creating a new webpart the result is same as below. I had searched a lot but I have not found any solution. Guys please help me to find out what is wrong.
D:\Mileage>gulp serve
internal/modules/cjs/loader.js:638
throw err;
^
Error: Cannot find module 'map-cache'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Module.require (internal/modules/cjs/loader.js:690:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous> (C:\Users\cdku7557807\AppData\Roaming\npm\node_modules
\gulp\node_modules\parse-filepath\index.js:6:16)
at Module._compile (internal/modules/cjs/loader.js:776:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
install npm package
npm install map-cache --save

node js express not able to resolve node modules/merge-descriptors

I have a simple node.js express application.
When I run npm run serve, I am getting below error.
In my node_modules folders I can see merge-descriptors folder, but when I try to start express server, looks like it is complaining about not able to find the component.
My path correctly has node_modules/.bin set.
internal/modules/cjs/loader.js:583
throw err;
^
Error: Cannot find module 'merge-descriptors'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
at Function.Module._load (internal/modules/cjs/loader.js:507:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object. (/tmp/site/node_modules/express/lib/express.js:16:13)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)

Node.Js - NPM - Error: Cannot find module 'umask' in Windows 10

I installed Node.JS 64x version 8.10.0 in windows 10. And everytime I use npm command in "cmd" always got this error. I tried this solution but still has the same error, topic: "error cannot find module 'umask'". Does anyone has a clue? Thank you very much.
C:\WINDOWS\system32>npm --version
module.js:549
throw err;
^
Error: Cannot find module 'umask'
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> (C:\ProgramData\Microsoft\VisualStudio\MDA\3702e81b\taco-toolset-6.3.1\node_modules\npm\lib\utils\umask.js:1:75)
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)

Cannot run express-spdy app using NodeJS

I'm not able to run NodeJS Express-Spdy examples downloaded from GitHub.
I'm getting the below error:
C:\Program Files\nodejs\node_modules\npm\node_modules\express-spdy>node app.js
module.js:340
throw err;
^
Error: Cannot find module 'express-spdy'
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> (C:\Program Files\nodejs\node_modules\npm\node_modules\express- spdy\app.js:6:15)
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 Function.Module.runMain (module.js:497:10)
Please tell me how to resolve this error, as I have put express-spdy inside node_modules folder.
When I run the example using SPDY module only by placing it inside node_modules it works fine but with express-spdy module it shows above error.

OData, JayData, and node.js: Cannot find ExpressionVisitor.js

I ran npm install odata-server, but calling require('odata-server') fails with the following:
Using JayLint for code parsing
module.js:340
throw err;
^
Error: Cannot find module './Types/Expressions/Visitors/ExpressionVisitor.js'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:362:17)
at require (module.js:378:17)
at Object.<anonymous> (/home/anewman/node_modules/odata-server/lib/jaydata/lib/index.js:28:1)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:362:17)
Try to reinstall the module and check that the missing file is there. Please also check your NODE_PATH settings because the library can not find the acorn parser module under ~/node_modules/odata-server/lib/jaydata/node-modules/acorn

Resources