I run below command
1 ionic package build ios --profile appname
2 ionic package info build_id(12)
Caught exception:
SyntaxError: Unexpected end of JSON input
at Object.parse (native)
at Request._callback (C:\Users\CakeDev\AppData\Roaming\npm\node_modules\ionic\node_modules\ionic-app-lib\lib\package.js:117:27)
at Request.self.callback (C:\Users\CakeDev\AppData\Roaming\npm\node_modules\ionic\node_modules\ionic-app-lib\node_modules\request\request.js:373:22)
at emitTwo (events.js:106:13)
at Request.emit (events.js:191:7)
at Request.<anonymous> (C:\Users\CakeDev\AppData\Roaming\npm\node_modules\ionic\node_modules\ionic-app-lib\node_modules\request\request.js:1318:14)
at emitOne (events.js:101:20)
at Request.emit (events.js:188:7)
at IncomingMessage.<anonymous> (C:\Users\CakeDev\AppData\Roaming\npm\node_modules\ionic\node_modules\ionic-app-lib\node_modules\request\request.js:1266:12)
at emitNone (events.js:91:20)
Related
So, I am not able to connect to MongoDB (Atlas). Feels like I may be going crazy here as logs are about as helpful as an anchor on a sinking boat. Here's what's going on. Thanks for the help.
Here's my server.js file:
'use strict';
const mongodb = require('mongodb');
const http = require('http');
const nconf = require('nconf');
let uri = 'mongodb://USERNAME:PASSWORD#cluster0-w4hci.mongodb.net/test?retryWrites=true&w=majority;';
Here's what console is saying
npm start
> test#1.0.0 start /home/XXXXXXX
> node server.js
mongodb://USERNAME:PASSWORD#cluster0-w4hci.mongodb.net/test?retryWrites=true&w=majority;
/home/XXXXXXX/node_modules/mongodb/lib/mongo_client.js:421
throw err
^
MongoError: failed to connect to server [cluster0-w4hci.mongodb.net:27017] on first connect [MongoError: getaddrinfo ENOTFOUND cluster0-w4hci.mongodb.net cluster0-w4hci.mongodb.net:27017]
at Pool.<anonymous> (/home/XXXXXXX/node_modules/mongodb-core/lib/topologies/server.js:336:35)
at emitOne (events.js:116:13)
at Pool.emit (events.js:211:7)
at Connection.<anonymous> (/home/XXXXXXX/node_modules/mongodb-core/lib/connection/pool.js:280:12)
at Object.onceWrapper (events.js:317:30)
at emitTwo (events.js:126:13)
at Connection.emit (events.js:214:7)
at Socket.<anonymous> (/home/XXXXXXX/node_modules/mongodb-core/lib/connection/connection.js:187:49)
at Object.onceWrapper (events.js:315:30)
at emitOne (events.js:116:13)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! test#1.0.0 start: `node server.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the test#1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/XXXXXXX/.npm/_logs/2020-02-23T15_17_31_259Z-debug.log
Turns out my node.js driver was a different version than what I thought. Once I selected the correct version from Atlas, the URI worked and I am not connected!
I deployed a NodeJS app to Heroku and provisioned an instance of MongoDB with MLab. Given that the password for the default database user is unclear (it never asks to set one up), I created a new user with admin privileges called mknerr. I set the MONGOLAB_URI variable like so:
heroku config:set MONGOLAB_URI=mongodb://mknerr:{password}#ds159631.mlab.com:59631/heroku_ws1jw516?authSource=heroku_ws1jw516&w=1
I tried to test the connection locally using mongo ds159631.mlab.com:59631/heroku_ws1jw516 -u mknerr -p {password} but I received the error "-bash: mongo: command not found" despite having already run npm mongodb. Rather than waste time trying to figure out where my mongo installation is, I switched to an instance of Cloud9 I know has mongo installed and ran the same command as above.
It appeared to confirm my credentials were accurate:
MongoDB shell version v3.6.5
connecting to: mongodb://ds159631.mlab.com:59631/heroku_ws1jw5l6
MongoDB server version: 3.6.6
Welcome to the MongoDB shell.
For interactive help, type "help".
For more comprehensive documentation, see
http://docs.mongodb.org/
Questions? Try the support group
http://groups.google.com/group/mongodb-user
rs-ds159631:PRIMARY>
However when I try to load my application, it throws a 503 error. After running heroku logs --tail I see:
2018-07-30T15:04:41.171411+00:00 heroku[web.1]: State changed from up to starting
2018-07-30T15:04:42.187835+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2018-07-30T15:04:42.324261+00:00 heroku[web.1]: Process exited with status 143
2018-07-30T15:04:43.802715+00:00 heroku[web.1]: Starting process with command `npm start`
2018-07-30T15:04:40.930637+00:00 app[api]: Set MONGOLAB_URI config vars by user {me}
2018-07-30T15:04:46.562425+00:00 app[web.1]:
2018-07-30T15:04:46.562447+00:00 app[web.1]: > todos_api#1.0.0 start /app
2018-07-30T15:04:46.562449+00:00 app[web.1]: > node index.js
2018-07-30T15:04:46.562450+00:00 app[web.1]:
2018-07-30T15:04:47.302228+00:00 app[web.1]: App is running on Port 21448
2018-07-30T15:04:47.339759+00:00 app[web.1]: ERROR connecting to: mongodb://mknerr:{password}#ds159631.mlab.com:59631/heroku_ws1jw516?authsSource=heroku_ws1jw516. MongoError: Authentication failed.
2018-07-30T15:04:47.341632+00:00 app[web.1]: (node:20) UnhandledPromiseRejectionWarning: MongoError: Authentication failed.
2018-07-30T15:04:47.341635+00:00 app[web.1]: at /app/node_modules/mongoose/node_modules/mongodb-core/lib/connection/pool.js:598:61
2018-07-30T15:04:47.341637+00:00 app[web.1]: at authenticateStragglers (/app/node_modules/mongoose/node_modules/mongodb-core/lib/connection/pool.js:516:16)
2018-07-30T15:04:47.341638+00:00 app[web.1]: at Connection.messageHandler (/app/node_modules/mongoose/node_modules/mongodb-core/lib/connection/pool.js:552:5)
2018-07-30T15:04:47.341640+00:00 app[web.1]: at emitMessageHandler (/app/node_modules/mongoose/node_modules/mongodb-core/lib/connection/connection.js:309:10)
2018-07-30T15:04:47.341642+00:00 app[web.1]: at Socket.<anonymous> (/app/node_modules/mongoose/node_modules/mongodb-core/lib/connection/connection.js:452:17)
2018-07-30T15:04:47.341644+00:00 app[web.1]: at emitOne (events.js:116:13)
2018-07-30T15:04:47.341646+00:00 app[web.1]: at Socket.emit (events.js:211:7)
2018-07-30T15:04:47.341647+00:00 app[web.1]: at addChunk (_stream_readable.js:263:12)
2018-07-30T15:04:47.341649+00:00 app[web.1]: at readableAddChunk (_stream_readable.js:250:11)
2018-07-30T15:04:47.341650+00:00 app[web.1]: at Socket.Readable.push (_stream_readable.js:208:10)
2018-07-30T15:04:47.341652+00:00 app[web.1]: at TCP.onread (net.js:597:20)
2018-07-30T15:04:47.341703+00:00 app[web.1]: (node:20) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
2018-07-30T15:04:47.341773+00:00 app[web.1]: (node:20) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Why is it failing to connect and throwing an authentication error despite my already having confirmed my credentials are accurate?
I was trying to use chrome-remote-interface sample in windows, but unable to produce the result with an error
Error: Unknown command: protocol
at IncomingMessage.<anonymous> (..\node_modules\chrome-remote-interface\lib\external-request.js:29:30)
at emitNone (events.js:110:20)
at IncomingMessage.emit (events.js:207:7)
at endReadableNT (_stream_readable.js:1059:12)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
This is the specs of my machine :
Google Chrome Version 66.0.3359.181 (Official Build) (64-bit)
Windows 10
I have a Meteor Application. I am trying to deploy my application by the custom deployment procedure (on my local machine) by following this article:
https://guide.meteor.com/deployment.html#custom-deployment
But I am facing this error when I run the application via node:
MongoError: failed to connect to server [192.168.100.2:9001] on first connect [MongoError: connect ECONNREFUSED 192.168.100.2:9001]
at Object.wait (/home/martini-henry/myapp-build/bundle/programs/server/node_modules/fibers/future.js:449:15)
at new MongoConnection (packages/mongo/mongo_driver.js:210:27)
at new MongoInternals.RemoteCollectionDriver (packages/mongo/remote_collection_driver.js:4:16)
at Object.<anonymous> (packages/mongo/remote_collection_driver.js:38:10)
at Object.defaultRemoteCollectionDriver (packages/underscore.js:784:19)
at new Mongo.Collection (packages/mongo/collection.js:99:40)
at AccountsServer.AccountsCommon (packages/accounts-base/accounts_common.js:23:18)
at AccountsServer (packages/accounts-base/accounts_server.js:18:5)
at server_main.js (packages/accounts-base/server_main.js:9:12)
at fileEvaluate (packages/modules-runtime.js:343:9)
- - - - -
at Pool.<anonymous> (/home/martini-henry/myapp-build/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb-core/lib/topologies/server.js:336:35)
at emitOne (events.js:96:13)
at Pool.emit (events.js:188:7)
at Connection.<anonymous> (/home/martini-henry/myapp-build/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb-core/lib/connection/pool.js:280:12)
at Connection.g (events.js:292:16)
at emitTwo (events.js:106:13)
at Connection.emit (events.js:191:7)
at Socket.<anonymous> (/home/martini-henry/myapp-build/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb-core/lib/connection/connection.js:187:49)
at Socket.g (events.js:292:16)
at emitOne (events.js:96:13)
Steps I performed:
First I came into the Meteor App directory and ran:
meteor build ../myapp-build --architecture os.linux.x86_64
Then I provided me the myapp.tar.gz and I extracted that.
Than I did:
- cd programs/server && npm install
- export MONGO_URL='mongodb://martini-henry:123456#192.168.100.2:9001/myappdb'
- export ROOT_URL='http://192.168.100.2:9000'
And at last when I ran:
- cd ../.. node main.js
I got that error above. What could be wrong here? Can anyone help me what I am doing wrong here?
I'm using mongoDB for an application following a tutorial here you have the link. While installing mongodb, I'm stuck at 9:50 and the command run to start mongod is mongod --directoryperdb --dbpath c:\mongodb\data\db --logpath c:\mongodb\log\mongo.log --logappend -rest --install
On my Mac I have my project and mongo directory on my desktop so I installed mongod following the above video. While starting mongod pointing to a different data directory using mongod --directoryperdb --dbpath /Usr/me/Desktop/mongodb/data/db --logpath /Usr/me/Desktop/mongodb/log/mongo.log --logappend -rest --install am having issues.
and it doesn't work (I have also copied the bin files to my local/bin directory
Below is the error.
events.js:160
throw er; // Unhandled 'error' event
^
MongoError: failed to connect to server [localhost:27017] on first connect [MongoError: connect ECONNREFUSED 127.0.0.1:27017]
at Pool.<anonymous> (/Users/houssamtoulni/Desktop/proget/node_modules/mongodb-core/lib/topologies/server.js:328:35)
at emitOne (events.js:96:13)
at Pool.emit (events.js:188:7)
at Connection.<anonymous> (/Users/houssamtoulni/Desktop/proget/node_modules/mongodb-core/lib/connection/pool.js:280:12)
at Connection.g (events.js:292:16)
at emitTwo (events.js:106:13)
at Connection.emit (events.js:191:7)
at Socket.<anonymous> (/Users/houssamtoulni/Desktop/proget/node_modules/mongodb-core/lib/connection/connection.js:177:49)
at Socket.g (events.js:292:16)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at emitErrorNT (net.js:1277:8)
at _combinedTickCallback (internal/process/next_tick.js:80:11)
at process._tickCallback (internal/process/next_tick.js:104:9)