Could not connect to MongoDB : MEAN : Windows 10 - node.js

Currently, I am trying to install MEAN on my windows 10 through cli (cmd).
I think i have completed all the installation part of MEAN and used npm to install all the packages as they were mentioned in tutorial and when I enter gulp (to run) it gives me this error :-
C:\...\nishant>gulp
Invoking gulp - development
[15:46:19] Using gulpfile ~\node\nishant\gulpfile.js
[15:46:19] Starting 'clean'...
[15:46:19] Finished 'clean' after 8.28 ms
[15:46:19] Starting 'default'...
[15:46:19] Starting 'webpack:build-dev'...
[15:46:19] Starting 'clean'...
[15:46:19] Starting 'less'...
[15:46:19] Starting 'sass'...
[15:46:19] Starting 'csslint'...
[15:46:19] Starting 'env:development'...
[15:46:19] Finished 'env:development' after 43 μs
[15:46:19] Starting 'devServe'...
[15:46:19] Finished 'devServe' after 96 ms
[15:46:19] Starting 'watch'...
[15:46:20] Finished 'watch' after 171 ms
[15:46:20] Finished 'clean' after 687 ms
[15:46:20] Finished 'less' after 692 ms
[15:46:20] Finished 'sass' after 418 ms
[15:46:20] csslint: 0 files lint free
[15:46:20] Finished 'csslint' after 399 ms
[15:46:20] [nodemon] 1.9.2
[15:46:20] [nodemon] to restart at any time, enter `rs`
[15:46:20] [nodemon] watching: *.*
[15:46:20] [nodemon] starting `node --debug server.js`
Debugger listening on port 5858
Error: connect ECONNREFUSED 127.0.0.1:27017
**Could not connect to MongoDB. Please ensure mongod is running and restart MEAN app.**
[15:46:27] [nodemon] clean exit - waiting for changes before restart
I tried to search for the answer but they were available for linux or mac but not for windows.

Looks like MongoDb is not running as a service. If memory serves, you may have to install the service manually. First check if it was installed: Start -> Run -> enter services.msc and look for it in the services list. If it's there, make sure it's running. If not, check out https://docs.mongodb.com/manual/tutorial/install-mongodb-on-windows/ for steps on service installation.

Related

Sharepoint (SPFx) extension built in Node/Gulp "Error: UNKNOWN: unknown error" on Gulp Serve overnight

I'm using this Microsoft guide to try to build a SharePoint extension and it's working fine, but for the past few days, I've noticed that gulp serve stops functioning overnight.
https://learn.microsoft.com/en-us/sharepoint/dev/spfx/extensions/get-started/build-a-hello-world-extension
[06:39:41] Using gulpfile ~\Documents\repos\helloSPFXReal\gulpfile.js
[06:39:41] Starting 'serve'...
[06:39:41] Starting gulp
[06:39:41] Starting subtask 'spfx-serve'...
[06:39:41] [spfx-serve] To load your scripts, use this query string: ?debug=true&noredir=true&debugManifestsFile=https://localhost:4321/temp/manifests.js
[06:39:43] Starting server...
[06:39:43] Finished subtask 'spfx-serve' after 1.46 s
[06:39:43] Starting subtask 'pre-copy'...
[06:39:43] Finished subtask 'pre-copy' after 117 ms
[06:39:43] Starting subtask 'copy-static-assets'...
[06:39:43] Starting subtask 'sass'...
[06:39:43] Server started https://localhost:4321
[06:39:43] LiveReload started on port 35729
[06:39:43] Running server
[06:39:43] Finished subtask 'sass' after 44 ms
[06:39:43] Starting subtask 'lint'...
[06:39:43] [lint] eslint version: 7.12.1
[06:39:43] Starting subtask 'tsc'...
[06:39:43] [tsc] typescript version: 4.5.5
[06:39:43] Finished subtask 'copy-static-assets' after 329 ms
[06:39:46] 'serve' errored after 4.78 s
[06:39:46] Error: UNKNOWN: unknown error, stat 'C:\Users\bork\Documents\Working\repos\helloSPFXReal\node_modules\postcss-modules-local-by-default'
About to exit with code: 1
Process terminated before summary could be written, possible error in async code not continuing!
Trying to exit with exit code 1
I was following the guide yesterday and it worked perfectly, I stopped for the day intending to pick up where I left off and it's suddenly erroring. This happened yesterday as well, but I just rebuilt the project from scratch to resolve it.
I tried closing the browser completely, CTRL+f5 to reload, logging out and back in for the sharepoint test page I'm using... no difference. I tried running gulp trust-dev-cert again and gulp serve --nobrowser and no change.
I can start a new project again today, but it's going to quickly become problematic having to rebuild my projects like Groundhog Day. What is going on?

Module not found: Error: Cannot resolve 'file' or 'directory' ../../

i am new for nodejs, in my hybris project, first i installed nodejs, run 'npm install','npm i cross-env' commands, when i run the command 'npm run hybris' from node_module folder, i got some errors can you provide any solution.
C:\Atlas_Insta\hybris\bin\custom\rodanandfields\rodanandfieldsstorefront\FE-Develop>npm run hybris
> RodanAndFields#1.0.0 hybris C:\Atlas_Insta\hybris\bin\custom\rodanandfields\rodanandfieldsstorefront\FE-Develop
> cross-env NODE_ENV=production gulp hybris-build
[15:29:07] Using gulpfile C:\Atlas_Insta\hybris\bin\custom\rodanandfields\rodanandfieldsstorefront\FE-Develop\gulpfile.js
[15:29:07] Starting 'clean'...
[15:29:07] Finished 'clean' after 128 ms
[15:29:07] Starting 'markupCompile'...
[15:29:08] Starting 'sass'...
[15:29:09] Finished 'sass' after 615 ms
[15:29:09] Starting 'js'...
[15:29:09] Finished 'js' after 129 ms
[15:29:09] Starting 'copy-img'...
[15:29:09] Finished 'copy-img' after 584 μs
[15:29:09] Starting 'copy-fonts'...
[15:29:09] Finished 'copy-fonts' after 597 μs
[15:29:09] Starting 'copy-api'...
[15:29:09] Finished 'copy-api' after 630 μs
[15:29:09] Starting 'read-templates'...
[15:29:09] Finished 'read-templates' after 1.87 ms
All templates written successfully!
[15:29:32] Version: webpack 1.15.0
Asset Size Chunks Chunk Names
app.js 1.19 MB 0 [emitted] app
app.map 9.63 MB 0 [emitted] app
ERROR in C:/Atlas_Repo/bin/custom/rodanandfields/rodanandfieldsstorefront/FE-Develop/web/webroot/WEB-INF/r2/fe-components/checkout/order-summary/order-summary.js
Module not found: Error: Cannot resolve 'file' or 'directory' ../../../../../_ui/frontend/js/analytics/analytics-eventmap-r2 in C:\Atlas_Repo\bin\custom\rodanandfields\rodanandfieldsstorefront\FE-Develop\web/webroot/WEB-INF/r2/fe-components\checkout\order-summary
# C:/Atlas_Repo/bin/custom/rodanandfields/rodanandfieldsstorefront/FE-Develop/web/webroot/WEB-INF/r2/fe-components/checkout/order-summary/order-summary.js 23:30-103
ERROR in C:/Atlas_Repo/bin/custom/rodanandfields/rodanandfieldsstorefront/FE-Develop/web/webroot/WEB-INF/r2/fe-components/checkout/checkout-form-billing/checkout-form-billing.js
Module not found: Error: Cannot resolve 'file' or 'directory' ../../../../../_ui/frontend/js/analytics/analytics-config-r2 in C:\Atlas_Repo\bin\custom\rodanandfields\rodanandfieldsstorefront\FE-Develop\web/webroot/WEB-INF/r2/fe-components\checkout\checkout-form-billing
# C:/Atlas_Repo/bin/custom/rodanandfields/rodanandfieldsstorefront/FE-Develop/web/webroot/WEB-INF/r2/fe-components/checkout/checkout-form-billing/checkout-form-billing.js 23:22-93
Which Hybris version are you using? I had a smilar problem with hybris 6.6. It worked for me after I switch to node v6.14.3 I was using a more recent node with a more recent npm version.
I found this version inside the npmancillary extension's folder
ext-content/npmancillary/resources/npm/node

Failed to load external module #babel/register while gulp

In my react project everything works fine on my vmware. But when I cloned the same app and ran gulp command I am getting this error during compilation saying
MacBook-Pro:Frontend1.0 apurvgandhwani$ gulp
[18:42:31] Failed to load external module #babel/register
[18:42:31] Requiring external module babel-register
[18:42:32] Using gulpfile ~/Frontend1.0/gulpfile.babel.js
[18:42:32] Starting 'build:watch'...
[18:42:32] Starting 'copy:assets'...
[18:42:32] Starting 'copy:vendors'...
Cleaned build/
Copied 12 asset entries.
[18:42:32] Finished 'copy:vendors' after 329 ms
[18:42:32] Starting 'copy:views'...
[18:42:32] copied views all files 19.75 kB
[18:42:32] Finished 'copy:views' after 77 ms
[18:42:32] Starting 'copy:public'...
[18:42:33] Finished 'copy:public' after 132 ms
[18:42:33] Finished 'copy:assets' after 540 ms
[18:42:33] Starting 'bundle:dll'...
DLL Bundled.
Hash: 45f26d608c690be6e6c5
Version: webpack 1.15.0
Time: 2181ms
Asset Size Chunks Chunk Names
dll.vendor.js 3.11 MB 0 [emitted] vendor
[18:42:35] Finished 'bundle:dll' after 2.21 s
[18:42:35] Starting 'bundle'...
Hash: 7457a3cd38cf5c991640
Version: webpack 1.15.0
Time: 508ms
Asset Size Chunks Chunk Names
server-bundle.js 37.3 kB 0 [emitted] main
-- server:watch bundled.
Hash: e4a95c52aac91b47f75c
Version: webpack 1.15.0
Time: 46339ms
Asset Size Chunks Chunk Names
main-bundle.js 20.1 MB 0 [emitted] main
-- client bundled.
[18:43:21] Finished 'bundle' after 46 s
[18:43:21] Starting 'start:server'...
Starting Node Server...
[18:43:21] Finished 'start:server' after 68 ms
[18:43:21] Starting 'watch:sync'...
[18:43:21] [nodemon] 1.11.0
[18:43:21] [nodemon] to restart at any time, enter `rs`
[18:43:21] [nodemon] watching: build/server-bundle.js
[18:43:21] [nodemon] starting `node --debug build/server-bundle.js`
Server Restarted: Reloading BrowserSync.
(node:6700) [DEP0062] DeprecationWarning: `node --debug` and `node --debug-brk` are invalid. Please use `node --inspect` or `node --inspect-brk` instead.
[18:43:21] [nodemon] app crashed - waiting for file changes before starting...
[tessact: ] Proxying: http://localhost:4200
[tessact: ] Access URLs:
-------------------------------------
Local: http://localhost:3001
External: http://192.168.0.32:3001
-------------------------------------
UI: http://localhost:3002
UI External: http://192.168.0.32:3002
-------------------------------------
[tessact: ] Watching files...
[18:43:21] Finished 'watch:sync' after 262 ms
[18:43:21] Starting 'watch:assets'...
[18:43:22] Finished 'watch:assets' after 110 ms
[18:43:22] Finished 'build:watch' after 50 s
[18:43:22] Starting 'default'...
[18:43:22] Finished 'default' after 37 μs
webpack built e4a95c52aac91b47f75c in 26323ms
Hash: e4a95c52aac91b47f75c
Version: webpack 1.15.0
Time: 26323ms
Asset Size Chunks Chunk Names
main-bundle.js 20.1 MB 0 main
webpack: Compiled successfully.
[18:50:28] [nodemon] restarting due to changes...
[18:50:28] [nodemon] starting `node --debug build/server-bundle.js`
Server Restarted: Reloading BrowserSync.
[tessact: ] Reloading Browsers...
(node:6705) [DEP0062] DeprecationWarning: `node --debug` and `node --debug-brk` are invalid. Please use `node --inspect` or `node --inspect-brk` instead.
[18:50:28] [nodemon] app crashed - waiting for file changes before starting...
Abort trap: 6
This is my package.json snippet
"dependencies": {
"#trendmicro/react-toggle-switch": "^0.5.5",
"animate.css": "^3.5.1",
"axis": "^0.6.1",
"babel-core": "^6.10.4",
"babel-loader": "^6.2.4",
"babel-preset-es2015": "^6.9.0",
"babel-preset-react": "^6.11.1",
"babel-preset-react-hmre": "^1.1.1",
I have followed a lot of threads but nothing seems to solve my case. What should I do to solve this? I already have babel-core instead of babel in my package.json which most of the solutions suggest.
I have solved it by downgrading the gulp version from 3.9.1 to 3.9.0. Looks like 3.9.1 is buggy.
This is just a warning that Gulp failed to load #babel/register but on the next line it successfully loaded the fallback module: babel-register
https://github.com/gulpjs/gulp/issues/1631
You could install the babel-core/register module to remove the warning, but it's not necessary.
You can remove the error with npm i -D babel-register (i = shorthand for install, D = shorthand for --save-dev)

gulp trust-dev-cert without error, but access the page still failed

After I upgrade my Nodejs to v9.3.0 and NPM to 5.5.1, failed to access the gulp serve server. The browser show the unsafe TLS security error.
I have removed ~.gcb-serve-data/, and run the gulp trust-dev-cert without error, but I cannot find the cert in my trust certificates, I am working in Win10.
Following is the **gulp trust-dev-cert" output:
[18:30:14] Starting gulp
[18:30:14] Starting 'trust-dev-cert'...
[18:30:14] Starting subtask 'configure-sp-build-rig'...
[18:30:14] Finished subtask 'configure-sp-build-rig' after 7.48 ms
[18:30:14] Starting subtask 'trust-cert'...
[18:30:14] Finished subtask 'trust-cert' after 79 ms
[18:30:14] Finished 'trust-dev-cert' after 90 ms
[18:30:14] ==================[ Finished ]==================
gulp trust-dev-cert must be executed IN the project folder.

JHipster gulp build not generating app.js for production

My application runs fine in development. When I run the production build, app.js is missing from the build/lib/www/app folder. Could anyone offer some insight on how to track down what is going wrong with my build?
Thanks.
Update:
I walked through all the gulpfile trying to understand what was going on and finally got to the build function called at the end of the assets:prod task. Within that function I replaced the templates variable in the line
.pipe(gulpIf('**/app.js', footer(templates)))
with a test string and it works. So now I'm down to working out which template of many is causing the problem. What a pain. Is there a way to get gulp to give you a little more info such as some of the chars near where the error occurred?
./gradlew -Pprod clean bootRepackage
Starting a Gradle Daemon (subsequent builds will be faster)
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
at gatling_b4a4yvzsw9z41nm1decp5w4n3.run(/Users/jreymann/projects-java/us.netblue/gradle/gatling.gradle:23)
:clean
:cleanResources UP-TO-DATE
:bootBuildInfo
:bower
:nodeSetup SKIPPED
:npmSetup SKIPPED
:npmInstall UP-TO-DATE
:gulpBuildWithOpts
[12:29:58] Using gulpfile ~/projects-java/us.netblue/gulpfile.js
[12:29:58] Starting 'clean'...
[12:29:58] Finished 'clean' after 4.63 ms
[12:29:58] Starting 'build'...
[12:29:58] Starting 'copy:fonts'...
[12:29:58] Starting 'copy:common'...
[12:29:58] Starting 'inject:vendor'...
[12:29:58] Starting 'ngconstant:prod'...
[12:29:58] Finished 'ngconstant:prod' after 23 ms
[12:29:58] gulp-inject 1 files into vendor.scss.
[12:29:58] Finished 'copy:common' after 78 ms
[12:29:58] gulp-inject 19 files into index.html.
[12:29:58] Finished 'inject:vendor' after 79 ms
[12:29:58] Finished 'copy:fonts' after 98 ms
[12:29:58] Starting 'copy'...
[12:29:58] Finished 'copy' after 19 μs
[12:29:58] Starting 'inject:app'...
[12:29:58] gulp-inject 143 files into index.html.
[12:29:58] Finished 'inject:app' after 168 ms
[12:29:58] Starting 'inject:troubleshoot'...
[12:29:58] gulp-inject Nothing to inject into index.html.
[12:29:58] Finished 'inject:troubleshoot' after 2.07 ms
[12:29:58] Starting 'images'...
[12:29:58] Starting 'sass'...
[12:29:58] Starting 'html'...
[12:29:58] Starting 'copy:swagger'...
[12:29:58] Starting 'copy:images'...
[12:29:58] Finished 'copy:images' after 8.98 ms
[12:29:59] Tested 18 tests, 18 passes, 0 failures: PASS
[12:29:59] gulp-imagemin: Minified 6 images (saved 6.79 kB - 17%)
[12:29:59] Finished 'images' after 459 ms
[12:29:59] Finished 'sass' after 492 ms
[12:29:59] Starting 'styles'...
[12:29:59] Finished 'styles' after 2.21 ms
[12:29:59] Finished 'html' after 527 ms
[12:29:59] Finished 'copy:swagger' after 527 ms
[12:29:59] Starting 'assets:prod'...
[12:30:12] Finished 'assets:prod' after 13 s
[12:30:12] Finished 'build' after 14 s
:processResources
:compileJava
[Fatal Error] shrinkwrap-descriptors-bom-2.0.0-alpha-3.pom:130:6: The processing instruction target matching "[xX][mM][lL]" is not allowed.
[Fatal Error] shrinkwrap-descriptors-bom-2.0.0-alpha-3.pom:130:6: The processing instruction target matching "[xX][mM][lL]" is not allowed.
[Fatal Error] commons-lang3-3.4.pom:772:1: Content is not allowed in trailing section.
[Fatal Error] commons-parent-39.pom:1506:5: The markup in the document following the root element must be well-formed.
[Fatal Error] commons-lang3-3.4.pom:772:1: Content is not allowed in trailing section.
[Fatal Error] commons-parent-39.pom:1506:5: The markup in the document following the root element must be well-formed.
[Fatal Error] commons-lang3-3.4.pom:772:1: Content is not allowed in trailing section.
:compileScala UP-TO-DATE
:classes
:findMainClass
:war
[Fatal Error] commons-lang3-3.4.pom:772:1: Content is not allowed in trailing section.
[Fatal Error] commons-lang3-3.4.pom:772:1: Content is not allowed in trailing section.
:bootRepackage
BUILD SUCCESSFUL
If I run the gulp build individually I get:
gulp build
[12:05:12] Using gulpfile ~/projects-java/us.netblue/gulpfile.js
[12:05:12] Starting 'clean'...
[12:05:12] Finished 'clean' after 21 ms
[12:05:12] Starting 'build'...
[12:05:12] Starting 'copy:fonts'...
[12:05:12] Starting 'copy:common'...
[12:05:12] Starting 'inject:vendor'...
[12:05:12] Starting 'ngconstant:prod'...
[12:05:12] Finished 'ngconstant:prod' after 25 ms
[12:05:12] gulp-inject 1 files into vendor.scss.
[12:05:12] Finished 'copy:common' after 80 ms
[12:05:12] gulp-inject 19 files into index.html.
[12:05:12] Finished 'inject:vendor' after 80 ms
[12:05:12] Finished 'copy:fonts' after 104 ms
[12:05:12] Starting 'copy'...
[12:05:12] Finished 'copy' after 24 μs
[12:05:12] Starting 'inject:app'...
[12:05:13] gulp-inject 143 files into index.html.
[12:05:13] Finished 'inject:app' after 179 ms
[12:05:13] Starting 'inject:troubleshoot'...
[12:05:13] gulp-inject Nothing to inject into index.html.
[12:05:13] Finished 'inject:troubleshoot' after 2.19 ms
[12:05:13] Starting 'images'...
[12:05:13] Starting 'sass'...
[12:05:13] Starting 'html'...
[12:05:13] Starting 'copy:swagger'...
[12:05:13] Starting 'copy:images'...
[12:05:13] Finished 'copy:images' after 7.44 ms
[12:05:13] Tested 18 tests, 18 passes, 0 failures: PASS
[12:05:13] gulp-imagemin: Minified 6 images (saved 6.79 kB - 17%)
[12:05:13] Finished 'images' after 439 ms
[12:05:13] Finished 'sass' after 483 ms
[12:05:13] Starting 'styles'...
[12:05:13] Finished 'styles' after 1.42 ms
[12:05:13] Finished 'html' after 511 ms
[12:05:13] Finished 'copy:swagger' after 514 ms
[12:05:13] Starting 'assets:prod'...
[12:05:26] gulp-notify: [JHipster Gulp Build] Error: Unexpected token .
[12:05:26] Finished 'assets:prod' after 13 s
[12:05:26] Finished 'build' after 14 s
After some hours of trying each template one at a time, I finally found the problem as being a typo in a template where there was a $ instead of $. That threw an the vague error in the JS related subtask in the build function.
If you open gulpfile.js there is a gulp task called 'html'.
If you run this task from the terminal by typing "gulp html" it will generate a file called 'templates.js' in 'target/tmp' folder.
This file has multiple $templateCache.put lines.
One of those lines maybe causing the error.
Run your application in PROD profile and keep the server running.
Delete almost all of the $templateCache.put lines except for homepage line in templates.js and run 'gulp build'.
Now hard refersh the browser and check if you are able to see the homepage.
If the homepage and the other lines are not causing the error you will see the homepage.
Now add back some of those deleted $templateCache.put lines to templates.js and run 'gulp build' again.
Repeat this process till you fine the line that is causing the issue.
Once you find out that line check the html page it mentions and try and remove all comments in that html file.
Some code in that html file maybe causing the issue.
Hope this helps.

Resources