mongo error when trying the npm start in bash [closed] - javascript

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 3 years ago.
Improve this question
When I am typing npm start in the bash to run my app locally, I get this result:
Listening on http://localhost:7200 Error connecting to mongo {
MongoNetworkError: failed to connect to server [localhost:27017] on
first connect [MongoNetworkError: connect ECONNREFUSED
127.0.0.1:27017]
at Pool. (C:\Users\Lope\Desktop\trainingCampus\week6\BERcycle\node_modules\mongodb-core\lib\topologies\server.js:431:11)
at Pool.emit (events.js:198:13)
at connect (C:\Users\Lope\Desktop\trainingCampus\week6\BERcycle\node_modules\mongodb-core\lib\connection\pool.js:557:14)
at makeConnection (C:\Users\Lope\Desktop\trainingCampus\week6\BERcycle\node_modules\mongodb-core\lib\connection\connect.js:39:11)
at callback (C:\Users\Lope\Desktop\trainingCampus\week6\BERcycle\node_modules\mongodb-core\lib\connection\connect.js:261:5)
at Socket.err (C:\Users\Lope\Desktop\trainingCampus\week6\BERcycle\node_modules\mongodb-core\lib\connection\connect.js:286:7)
at Object.onceWrapper (events.js:286:20)
at Socket.emit (events.js:198:13)
at emitErrorNT (internal/streams/destroy.js:91:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
at process._tickCallback (internal/process/next_tick.js:63:19) name: 'MongoNetworkError', errorLabels: [
'TransientTransactionError' ], [Symbol(mongoErrorContextSymbol)]: {}
}
How can I solve this?

A TransientTransactionError is a transactional error that is classified as temporary, and if retried it may be successful. Furthermore, a TransientTransactionError write conflict occurs prior to a commit when no write lock has been taken and the transaction (new data) is not reflected in the transaction snapshot (previous data). As a result, these errors are completely safe to retry until there is a successful commit
Please also try to add your current IP to whiteList following "main page > security section > network access > add IP" in MongoDB website

Try out the following code:
sudo rm -rf /tmp/mongodb-27017.sock
sudo service mongod start
ls -lsah /tmp/mongodb-27017.sock
0 srwx------ 1 mongodb mongodb 0 Aug 24 04:01 /tmp/mongodb-27017.sock

First, Check If you are able to connect with mongo locally,
Use this command
mongo
Now there will be two scenario.
1. mongo is not running locally on localhost:27017
2. If mongo is running locally then use below command
mongod
Above command will give you the exact error causing mongo to not start.
Do check this and then share further detail.

Here's what I do and have everything up and running without issues. After downloading mongo from official site, unzip the contents, change the folder name to “mongodb”, and move it to your users home directory. From there, create a “mongodb-data” directory in your user directory to store the database data. You can start the server using the following command. Make sure to swap out “username” with the correct path to your users home directory. /Users/{username}/mongodb/bin/mongod --dbpath=/Users/{username}/mongodb-data
This is for Mac installation btw but should be similar to other OSs

Related

How to fix "ENOTDIR" error when publishing to AWS Amplify

I am trying to push our latest code to our AWS Amplify project in the cloud. The other dev on our team does amplify publish and everything pushes to the cloud fine. When I do amplify publish it throws an ENOTDIR error. I feel like that means I am missing a dependency or a dependency got corrupted or something? I am at a loss.
I have tried doing amplify codegen, amplify env pull --restore, and I have tried removing and reading the #aws-amplify/cli package that I installed to my app directory with yarn when first installing everything for this web app. I know it's connected to the cloud properly because me and the other dev's amplify status output matches, as well as the amplify env get --name <environment name> command output.
The error I get every time I do amplify push is:
No changes detected
/usr/local/lib/node_modules/#aws-amplify/cli/node_modules/gluegun/build/index.js:13
throw up;
^
Error: spawn ENOTDIR
at ChildProcess.spawn (internal/child_process.js:394:11)
at spawn (child_process.js:542:9)
at /usr/local/lib/node_modules/#aws-amplify/cli/node_modules/amplify-frontend-javascript/lib/builder.js:13:28
at new Promise (<anonymous>)
at Object.run (/usr/local/lib/node_modules/#aws-amplify/cli/node_modules/amplify-frontend-javascript/lib/builder.js:6:10)
at Object.run (/usr/local/lib/node_modules/#aws-amplify/cli/node_modules/amplify-frontend-javascript/lib/publisher.js:9:18)
at Object.publish (/usr/local/lib/node_modules/#aws-amplify/cli/node_modules/amplify-frontend-javascript/index.js:33:20)
at Command.run (/usr/local/lib/node_modules/#aws-amplify/cli/src/commands/publish.js:41:29)
at processTicksAndRejections (internal/process/task_queues.js:85:5) {
errno: 'ENOTDIR',
code: 'ENOTDIR',
syscall: 'spawn'
Thanks for any input on how to fix this! I am leery to try too much else on my own because I do not want to accidentally delete what is already in the cloud.

MongoDB no longer starts after updating

I recently updated my MongoDB server from 3.2 to 3.6 to fix some errors with naming. When I had my Mongo server as 3.2 it did work fine.
I downloaded the MongoDB 3.6 from https://www.mongodb.com/download-center/community and installed it with the package manager (sudo dpkg -i mongodb-org-server_3.6.12_amd64.deb) and I have verified that the server did update with mongod --version.
As far as I know, starting the system works, but when I run mongo, or sudo mongo, it gives me the following output
MongoDB shell version: 3.2.22
connecting to: test
2019-05-14T13:28:09.049-0400 W NETWORK [thread1] Failed to connect to 127.0.0.1:27017, in(checking socket for error after poll), reason: errno:111 Connection refused
2019-05-14T13:28:09.049-0400 E QUERY [thread1] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed :
connect#src/mongo/shell/mongo.js:229:14
#(connect):1:6
exception: connect failed
I'm not sure how I could fix the problem either, I have tried to restart the service and restarting the server it's running on (Ubuntu 16.04) and neither worked. Nothing I found online could help either so if you know a possible solution, please let me know, thanks!
Before that, try with
sudo service mongod stop
sudo rm /var/lib/mongodb/mongod.lock
mongod –repair
sudo service mongod start

Apache cordova ,Unable to create an app

This is the output , knowing that i'm running it under a proxy , and i specified the proxy settings.
npm config set proxy http://proxy.company.com:8080
npm config set https-proxy http://proxy.company.com:8080
then i run this command to create a new app in the specified folder "hello".
C:\>cordova create hello com.example.hello HelloWorld
Creating a new cordova project with name "HelloWorld" and id "com.example.hello"
at location "C:\hello"
Downloading cordova library for www...
this is the error :
Error: connect ETIMEDOUT
at errnoException (net.js:904:11)
at Object.afterConnect [as oncomplete] (net.js:895:19)
I recently had the same issue. I was maintaining an existing app and updating Cordova was well beyond the scope of the current task, so getting this working was really my only option.
Firstly, in order to eliminate all the errors and warnings about deprecated APIs when installing Cordova, I had to use some really ancient package managers. Using NVM I installed node 0.10.48 and npm 1.4.29. Cordova 3.6.3 then installed without any complaints.
But even creating an empty Cordova project wasn't possible as the below output shows:
Creating a new cordova project with name "HelloWorld" and id "com.example.hello" at location "~/Downloads"
Downloading cordova library for www...
Error: HTTP error 404 retrieving version 3.6.3 of cordova for www
at Request._callback (~/.nvm/v0.10.48/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/lazy_load.js:230:30)
at Request.self.callback (~/.nvm/v0.10.48/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/request/index.js:148:22)
at Request.emit (events.js:98:17)
at Request.<anonymous> (~/.nvm/v0.10.48/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/request/index.js:886:14)
at Request.emit (events.js:117:20)
at IncomingMessage.<anonymous> (~/.nvm/v0.10.48/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/request/index.js:837:12)
at IncomingMessage.emit (events.js:117:20)
at _stream_readable.js:944:16
at process._tickCallback (node.js:458:13)
Adding some extra debug output to lazy_load.js revealed that the CLI was looking for a directory at ~/.cordova/lib/www/cordova/3.6.3.
Since this was a brand new installation of Cordova, that directory obviously wasn't present so it went to download an archive from https://git-wip-us.apache.org/repos/asf?p=cordova-app-hello-world.git;a=snapshot;h=3.6.3;sf=tgz but the archive that used to be there has apparently been removed. I found it at https://github.com/apache/cordova-app-hello-world/releases/tag/3.6.3.
I download that archive and extracted it to ~/.cordova/lib/www/cordova/3.6.3, and I was then able to create my template app.
I know this thread is old but I really hope this helps someone. Working with Cordova is a bitch at the best of times, let alone when vital online components are removed like this.
On OSX Yosemite even with sudo the error persists.
after digging a little bit more. i found the solution.
I have just run the cmd.exe as administrator. after that worked like magic.
I ran into this problem by not installing cordova as admin. I had to sudo npm install -g cordova to get the create command to work.

Meteor on windows - Server crashes on code push

I installed Meteor for windows from here :
http://win.meteor.com
The server crashes almost every time I try to make live code push.
I would then have to end the mongod.exe process and run 'meteor reset' and 'meteor' to start it up back again.
Here are the logs:
=> Meteor server restarted
events.js:71
throw arguments[1]; // Unhandled 'error' event
^
Error: This socket is closed.
at Socket._write (net.js:519:19)
at Socket.write (net.js:511:15)
at Socket.HttpProxy.proxyWebSocketRequest.reverseProxy.incoming.socket.on.listeners.onOutgoing (C:\Program Files\Meteor\lib\node_modules\http-proxy\lib\node-http-proxy\http-proxy.js:515:35)
at Socket.EventEmitter.emit (events.js:96:17)
at TCP.onread (net.js:397:14)
Anyone on the same boat? I read from here https://github.com/meteor/meteor/issues/513 that this has been an open issue for over 6 months.
Someone's got any workaround? Help appreciated.
The EADDRINUSE issue was fixed in 0.6.3.1-rev4, but please update to version 0.6.4 as this problem seems to have resolved the other issue by the update to the http-proxy package.
For MSI downloads see https://github.com/sdarnell/meteor/wiki/Windows
Should also appear on http://win.meteor.com soon
This is a known issue with windows for meteor : https://github.com/sdarnell/meteor/issues/7. The one on meteor's github repo might also be related. I have it too! Hopefully they sort it out soon!. Just ctrl+c to stop your server before you edit code and get it back up after you're done.
Even if you start it after this sometimes you could also get an ADDRINUSE error, which is quite frustrating.

could not connect to MongoDB

I have an issue using the mean.io tutorial to create the default mean app. i have mongodb install what could be ths issue this is the error.That is the error below. Thanks.
PS C:\Users\Truparse Creative\Documents\myMeanProject\lisavogue> npm test
> mean#0.5.5 test C:\Users\Truparse Creative\Documents\myMeanProject\lisavogue
> gulp test
Invoking gulp - development
[08:40:17] Using gulpfile ~\Documents\myMeanProject\lisavogue\gulpfile.js
[08:40:17] Starting 'startServer'...
Error: connect ECONNREFUSED 127.0.0.1:27017
**Could not connect to MongoDB. Please ensure mongod is running and restart MEAN app.**
in your terminal, type mongod to start mongodb and leave it running. Then, open a new terminal tab(or window) and try running your application again.
You need the mongodb server to be running to be able to use it. It looks like you're not running it.
You can also access the mongo shell by running mongo in your terminal to look at the server, collections, perform queries, etc.

Categories

Resources