Nodejs: npm throwing error when using monk - node.js

I'm building a NodeJS app using ExpressJS framework.
I'm trying to use monk to connect to MongoDB
var monk = require('monk');
var db = monk('localhost:3000/nodeauth');
When I do npm start , I'm getting the following error:
npm start
> jsblog#0.0.0 start /home/bytegeek/Codes/Expressprojects/jsblog
> node ./bin/www
/home/bytegeek/Codes/Expressprojects/jsblog/node_modules/mongoskin/lib/utils.js:33
var skinClassName = 'Skin' + NativeClass.name;
^
TypeError: Cannot read property 'name' of undefined
at makeSkinClass (/home/bytegeek/Codes/Expressprojects/jsblog/node_modules/mongoskin/lib/utils.js:33:43)
at Object.<anonymous> (/home/bytegeek/Codes/Expressprojects/jsblog/node_modules/mongoskin/lib/grid.js:6:35)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Module.require (module.js:367:17)
at require (internal/module.js:16:19)
at Object.<anonymous> (/home/bytegeek/Codes/Expressprojects/jsblog/node_modules/mongoskin/lib/db.js:22:16)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Module.require (module.js:367:17)
at require (internal/module.js:16:19)
at Object.<anonymous> (/home/bytegeek/Codes/Expressprojects/jsblog/node_modules/mongoskin/lib/mongo_client.js:5:14)
npm ERR! Linux 4.2.0-34-generic
npm ERR! argv "/opt/node-v5.7.1-linux-x64/bin/node" "/opt/node-v5.7.1-linux-x64/bin/npm" "start"
npm ERR! node v5.7.1
npm ERR! npm v3.6.0
npm ERR! code ELIFECYCLE
npm ERR! jsblog#0.0.0 start: `node ./bin/www`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the jsblog#0.0.0 start script 'node ./bin/www'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the jsblog package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node ./bin/www
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs jsblog
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls jsblog
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /home/bytegeek/Codes/Expressprojects/jsblog/npm-debug.log
I already have a MongoDB database nodeauth and also have some contents in it. mongod service is also running.
P.S: If I remove the above two lines of codes and do npm start , there is no error and I'm able to see the express welcome page at localhost:3000

Check your MongoDB port where it is running. if you did not change the default port , it should be http://localhost:27017/nodeauth
I think your app is running on 3000 port. so, check the mongod port and check again.

omit he port number for monk module. try this way.
var db = require('monk')('localhost/nodeauth');

Related

how do I solve the missing modules problem in parse server

I have installed the parse server and it runs the single command post/put correctly.
However, after I added the express.js framework, I used “npm start – /var/www/parse_server/config.json” to run the server.
Then, I got the following errors.
How do I install the missing modules? Thanks
(1to1call) Tom:parse_server mariolzx$ npm start -- /var/www/parse_server/config.json
> parse-server#4.5.0 start /private/var/www/parse_server/parse_server
> node ./bin/parse-server "/var/www/parse_server/config.json"
internal/modules/cjs/loader.js:969
throw err;
^
Error: Cannot find module '/var/www/parse_server/config.json'
Require stack:
- /private/var/www/parse_server/parse_server/lib/cli/utils/commander.js
- /private/var/www/parse_server/parse_server/lib/cli/utils/runner.js
- /private/var/www/parse_server/parse_server/lib/cli/parse-server.js
- /private/var/www/parse_server/parse_server/bin/parse-server
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966:15)
at Function.Module._load (internal/modules/cjs/loader.js:842:27)
at Module.require (internal/modules/cjs/loader.js:1026:19)
at require (internal/modules/cjs/helpers.js:72:18)
at parseConfigFile (/private/var/www/parse_server/parse_server/lib/cli/utils/commander.js:93:24)
at Command._commander.Command.parse (/private/var/www/parse_server/parse_server/lib/cli/utils/commander.js:139:20)
at _default (/private/var/www/parse_server/parse_server/lib/cli/utils/runner.js:57:22)
at Object.<anonymous> (/private/var/www/parse_server/parse_server/lib/cli/parse-server.js:38:21)
at Module._compile (internal/modules/cjs/loader.js:1138:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/private/var/www/parse_server/parse_server/lib/cli/utils/commander.js',
'/private/var/www/parse_server/parse_server/lib/cli/utils/runner.js',
'/private/var/www/parse_server/parse_server/lib/cli/parse-server.js',
'/private/var/www/parse_server/parse_server/bin/parse-server'
]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! parse-server#4.5.0 start: `node ./bin/parse-server "/var/www/parse_server/config.json"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the parse-server#4.5.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! /Users/mariolzx/.npm/_logs/2021-02-28T01_57_37_051Z-debug.log
(1to1call) Tom:parse_server mariolzx$ npm start -- /var/www/parse_server/config.json

Express-getting this error message trying to run server

I'm trying to run the server on the back-end of a project I'm doing and I keep getting this error message and it stops the server from running. I installed express generator if that makes any difference
> server#0.0.0 start /Users/username/Desktop/project/server
> node ./bin/www
internal/modules/cjs/loader.js:905
throw err;
^
Error: Cannot find module 'http-errors'
Require stack:
- /Users/username/Desktop/project/server/main/app.js
- /Users/username/Desktop/project/server/bin/www
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
at Function.Module._load (internal/modules/cjs/loader.js:747:27)
at Module.require (internal/modules/cjs/loader.js:974:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.<anonymous> (/Users/username/Desktop/project/server/main/app.js:1:19)
at Module._compile (internal/modules/cjs/loader.js:1085:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:791:14)
at Module.require (internal/modules/cjs/loader.js:974:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/Users/username/Desktop/project/server/main/app.js',
'/Users/username/Desktop/project/server/bin/www'
]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! server#0.0.0 start: `node ./bin/www`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the server#0.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! /Users/username/.npm/_logs/2020-11-13T03_27_43_635Z-debug.log
It clearly says Error: Cannot find module 'http-errors', so you probably don't have the package installed locally. Run npm i http-errors to download it.
Alternatively, if you'd like to save the package as a dependency in your project, run npm i http-errors --save

create-react-library cannot run npm start

I cloned create-react-library from https://github.com/UdiliaInc/create-react-library but cannot get it to start.
I have made no edits. I ran npm install and then npm start. When I run npm start I get the same error described in the below post.
Nodejs npm scripts fail with "SyntaxError: Unexpected token {"
I checked my node version and it is 5.3.0. Any other reasons why this could be happening?
The error is
`[clynch#localhost create-react-library]$ npm start
create-react-library#1.0.0 start /home/clynch/git/create-react-library
node scripts/start.js
/home/clynch/git/create-react-library/scripts/start.js:23
const { choosePort,
^
SyntaxError: Unexpected token {
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:374:25)
at Object.Module._extensions..js (module.js:405:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Function.Module.runMain (module.js:430:10)
at startup (node.js:141:18)
at node.js:980:3
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! create-react-library#1.0.0 start: `node scripts/start.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the create-react-library#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/clynch/.npm/_logs/2017-11-16T21_05_24_465Z-debug.log
`
You should update your node version to 6.12 or 7+
For reference, check http://node.green/

Error when running vuetifyjs template

I have successfully installed a vuetifyjs template using the command
vue init vuetifyjs/webpack-advanced
it was successfully installed but when I tried to use the command npm run dev I had the following error message:
C:\Users\Muse\Documents\vuetify>npm run dev
vuetify#1.0.0 dev C:\Users\Muse\Documents\vuetify
node build/dev-server.js
fs.js:1657
binding.lstat(baseLong);
^
Error: ENOENT: no such file or directory, lstat 'C:\Users\Muse\Documents\vuetify\test'
at Object.realpathSync (fs.js:1657:15)
at resolve (C:\Users\Muse\Documents\vuetify\build\webpack.base.conf.js:8:13)
at Object. (C:\Users\Muse\Documents\vuetify\build\webpack.base.conf.js:35:35)
at Module._compile (module.js:573:30)
at Object.Module._extensions..js (module.js:584:10)
at Module.load (module.js:507:32)
at tryModuleLoad (module.js:470:12)
at Function.Module._load (module.js:462:3)
at Module.require (module.js:517:17)
at require (internal/module.js:11:18)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! vuetify#1.0.0 dev: node build/dev-server.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the vuetify#1.0.0 dev 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! C:\Users\Muse\AppData\Roaming\npm-cache_logs\2017-08-31T09_19_06_701Z-debug.log
You just need to create a test folder and give it access.
It's a bug with webpack-advanced template
Fore install your project dependencies
npm install -f
Then, make a folder named "test" in your root project
mkdir test
It's a bug caused by vuetifyjs/webpack-advanced

Google Firebase functions ImageMagick thumbnail creation failing

I am working on google firebase functions to generate thumbnails for images using imagemagic, I did exactly what is mentioned in this link
and also I have gone through this link.
I am getting the following exception while deploying using gcloud app deploy command. I have gone through other SO posts(link) which are similar to this issue.
I also have updated firebase tools using (npm install -g firebase-tools). is anything else I am missing ?
In the exception is says
at Object. (/app/lib/functions.js:43:47) at line number 43 the code snippet looks like this
exports.generateThumbnail = functions.storage.object().onChange(event => {
Exception looks as follows
Updating service [default]...failed.
ERROR: (gcloud.app.deploy) Error Response: [9]
Application startup error:
> nodejs-getting-started#1.0.0 start /app
> node app.js
/app/node_modules/firebase-functions/lib/config.js:51
throw new Error('Firebase config variables are not available. ' +
^
Error: Firebase config variables are not available. Please use the latest version of the Firebase CLI to deploy this function.
at init (/app/node_modules/firebase-functions/lib/config.js:51:15)
at Object.config (/app/node_modules/firebase-functions/lib/config.js:29:9)
at Object.object (/app/node_modules/firebase-functions/lib/providers/storage.js:41:27)
at Object.<anonymous> (/app/lib/functions.js:43:47)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
npm ERR! Linux 3.16.0-4-amd64
npm ERR! argv "/nodejs/bin/node" "/nodejs/bin/npm" "start"
npm ERR! node v6.11.0
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! nodejs-getting-started#1.0.0 start: `node app.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the nodejs-getting-started#1.0.0 start script 'node app.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the nodejs-getting-started package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node app.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs nodejs-getting-started
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls nodejs-getting-started
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /app/npm-debug.log

Resources