I am trying to deploy my first node application to production server in a shared hosting platform but whenever I run the start script I get the following error message:
returncode: 1 stdout:
thechoicebox-backend@1.0.0 dev /home/ftijpnql/tcb
node server.js --scripts-prepend-node-path stderr: npm WARN lifecycle The node binary used for scripts is
/home/ftijpnql/nodevenv/tcb/14/bin/node but npm is using /opt/alt/alt-nodejs14/root/usr/bin/node itself. Use the
--scripts-prepend-node-pathoption to include the path for the node binary npm was executed with. internal/modules/cjs/loader.js:905
throw err; ^Error: Cannot find module '/home/ftijpnql/nodevenv/tcb/14/lib/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node' Require stack:
- /home/ftijpnql/nodevenv/tcb/14/lib/node_modules/bcrypt/bcrypt.js
- /home/ftijpnql/tcb/src/controller/admin-auth.controller.js
- /home/ftijpnql/tcb/src/app.js
- /home/ftijpnql/tcb/server.js at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15) at Function.Module._load (internal/modules/cjs/loader.js:746:27) at Module.require (internal/modules/cjs/loader.js:974:19) at require (internal/modules/cjs/helpers.js:92:18) at Object. (/home/ftijpnql/nodevenv/tcb/14/lib/node_modules/bcrypt/bcrypt.js:6:16) at Module._compile (internal/modules/cjs/loader.js:1085:14) 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:790:14) at Module.require (internal/modules/cjs/loader.js:974:19) { code: 'MODULE_NOT_FOUND', requireStack: [ '/home/ftijpnql/nodevenv/tcb/14/lib/node_modules/bcrypt/bcrypt.js', '/home/ftijpnql/tcb/src/controller/admin-auth.controller.js', '/home/ftijpnql/tcb/src/app.js', '/home/ftijpnql/tcb/server.js' ] } npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! thechoicebox-backend@1.0.0 dev:
node server.js --scripts-prepend-node-pathnpm ERR! Exit status 1 npm ERR! npm ERR! Failed at the thechoicebox-backend@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!
/home/ftijpnql/.npm/_logs/2021-10-05T16_19_33_946Z-debug.log
Although with same dependency and node version the project is running in my system.
package.json
{
"name": "thechoicebox-backend",
"version": "1.0.0",
"engines": {
"node": "14.7.0"
},
"description": "",
"main": "index.js",
"scripts": {
"start": "node dist/app.js",
"dev": "nodemon server.js"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"bcrypt": "^5.0.1",
"body-parser": "^1.19.0",
"dotenv": "^10.0.0",
"express": "^4.17.1",
"http": "0.0.1-security",
"jsonwebtoken": "^8.5.1",
"multer": "^1.4.2",
"mysql2": "^2.2.5",
"sequelize": "^6.6.2"
},
"devDependencies": {
"nodemon": "^2.0.7"
}
}
My production node version is 14.x.x not same as in package.json file as that was not present there.
Kindly help me out I am stuck !