Error while deploying nodejs server on google cloud - node.js

seeking help for my personal project. My project is running perfectly on my localhost but when I try to deploy it on google cloud, it is giving me some sort of module error .
Here is the error i am receiving
Updating service [default] (this may take several minutes)...failed.
ERROR: (gcloud.app.deploy) Error Response: [9] An internal error occurred while processing task /app-engine-flex/flex_await_healthy/flex_await_healthy>2022-06-10T08:18:51.725Z29622.hc.2:
> buy-and-sell-backend#1.0.0 start /app
> node ./build/server.js
/app/node_modules/#hapi/boom/lib/index.js:126
return internals.initialize(err, options.statusCode ?? 500, options.message);
^
SyntaxError: Unexpected token '?'
at wrapSafe (internal/modules/cjs/loader.js:931:16)
at Module._compile (internal/modules/cjs/loader.js:979:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1035:10)
at Module.load (internal/modules/cjs/loader.js:879:32)
at Function.Module._load (internal/modules/cjs/loader.js:724:14)
at Module.require (internal/modules/cjs/loader.js:903:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (/app/build/routes/getListing.js:14:36)
at Module._compile (internal/modules/cjs/loader.js:1015:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1035:10)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! buy-and-sell-backend#1.0.0 start: `node ./build/server.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the buy-and-sell-backend#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! /root/.npm/_logs/2022-06-10T08_19_42_250Z-debug.log
here is the link of my code
https://github.com/abhijitutkarsh/buy-and-sell-backend/tree/update
I have also tried deleting the node_modules and package.lock.json and then running npm install again
Still it didn't work kindly help

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

There is a problem when running a node application on ubuntu 18.04

I am trying to run a node site on an azure VM but I get this error when running > SkyCrypt#1.0.0 start
> node init && node index
internal/modules/cjs/loader.js:1109
throw err;
^
SyntaxError: /home/nim1com/SkyCrypt/credentials.json: Unexpected token v in JSON at position 216
at parse (<anonymous>)
at Object.Module._extensions..json (internal/modules/cjs/loader.js:1106:22)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.<anonymous> (/home/nim1com/SkyCrypt/init.js:15:21)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! SkyCrypt#1.0.0 start: `node init && node index`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the SkyCrypt#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/nim1com/.npm/_logs/2021-01-19T09_41_40_472Z-debug.log```
What would be the answer to this problem? I have tried deleting package-lock.json and node_modules
credentials.json
{
"hypixel_api_key": "26ed366f-80ed-4b49-b912-ef46292c6225",
"recaptcha_site_key": "",
"recaptcha_secret_key": "",
"dbUrl": "mongodb+srv://dbStats:*********#cluster0.4kwsp.mongodb.net/test?retryWrites=true&w=majority",
"dbName": vmstats",
"session_secret": "36e47c144b9b9b3e0b9c8bf24c6ac2860c0f76a55b74dcea4007bf355af76789"
}
It seems your /home/nim1com/SkyCrypt/credentials.json file need to be corrected ...
read the error its complaining about the v in "dbName": vmstats", because is not valid json – Lawrence Cherone

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

How to properly set up dev environment using node and npm for Material.io components?

I've done the codepens provided by Material.io however when I try to follow the same steps using my own files, I always get an error.
> webpack-dev-server --progress
internal/modules/cjs/loader.js:983
throw err;
^
Error: Cannot find module 'webpack/bin/config-yargs'
Require stack:
- C:\Users\willy\Desktop\Wireframes-master\Front Page\node_modules\webpack-dev-server\bin\webpack-dev-server.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:980:15)
at Function.Module._load (internal/modules/cjs/loader.js:862:27)
at Module.require (internal/modules/cjs/loader.js:1042:19)
at require (internal/modules/cjs/helpers.js:77:18)
at Object.<anonymous> (C:\Users\willy\Desktop\Wireframes-master\Front Page\node_modules\webpack-dev-server\bin\webpack-dev-server.js:54:1)
at Module._compile (internal/modules/cjs/loader.js:1156:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1176:10)
at Module.load (internal/modules/cjs/loader.js:1000:32)
at Function.Module._load (internal/modules/cjs/loader.js:899:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'C:\\Users\\willy\\Desktop\\Wireframes-master\\Front Page\\node_modules\\webpack-dev-server\\bin\\webpack-dev-server.js'
]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! mdc-101-web#0.0.0 start: `webpack-dev-server --progress`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the mdc-101-web#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! C:\Users\willy\AppData\Roaming\npm-cache\_logs\2020-04-10T15_13_14_365Z-debug.log
C:\Users\willy\Desktop\Wireframes-master\Front Page>webpack-dev-server --progress
'webpack-dev-server' is not recognized as an internal or external command,
operable program or batch file.
I am still new to web development and most of this log is alien to me, I've found similar issues online however their solutions have not fixed my issue.
Versions:
npm: 6.14.4
webpack: 4.42.1
node.js: 12.16.2
UPDATE: It seems that when I first install npm, everything goes just fine, however there a 3 original vulnerabilities. Before I audit fix them, the npm start command works just fine and successfully compiles. When I run the npm audit to see the details of the vulnerabilities, I use the suggested commands to fix them. Once I've done that it no longer works.

NPM showing error message after adding the Prop-Types in react project

This is the error message after I finished installation of Prop-Types Validation in my create-react-app
> burgerapp#0.1.0 start C:\Users\ajeet\Desktop\burgerapp
> node scripts/start.js
module.js:540
throw err;
^
Error: Cannot find module 'webpack'
at Function.Module._resolveFilename (module.js:538:15)
at Function.Module._load (module.js:468:25)
at Module.require (module.js:587:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (C:\Users\ajeet\Desktop\burgerapp\scripts\start.js:19:17)
at Module._compile (module.js:643:30)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
at Function.Module._load (module.js:491:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! burgerapp#0.1.0 start: `node scripts/start.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the burgerapp#0.1.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! C:\Users\ajeet\AppData\Roaming\npm-cache\_logs\2018-02-04T23_43_08_160Z-debug.log
Please help me to find solution. Thank you for your help.
this just sometimes happens with npm when adding packages, especially with create-react-app projects. Delete node_modules and run npm install again, that should fix it.
You can install webpack by using command 'npm install webpack --dev'.

Resources