My repository: https://github.com/jacklemasters/tech-blog
The app works locally on my machine, but I cannot seem to figure out why it will not work on Heroku. I have attempted completely moving the code, a new repository, nothing seems to help.
Here are the error logs I am receiving from Heroku:
2021-10-04T14:32:52.833339+00:00 app[web.1]: npm ERR! tech-blog#1.0.0 start: node server.js
2021-10-04T14:32:52.833414+00:00 app[web.1]: npm ERR! Exit status 1
2021-10-04T14:32:52.833484+00:00 app[web.1]: npm ERR!
2021-10-04T14:32:52.833533+00:00 app[web.1]: npm ERR! Failed at the tech-blog#1.0.0 start script.
2021-10-04T14:32:52.833601+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2021-10-04T14:32:52.847732+00:00 app[web.1]:
2021-10-04T14:32:52.847831+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2021-10-04T14:32:52.847916+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2021-10-04T14_32_52_834Z-debug.log
2021-10-04T14:32:53.006395+00:00 heroku[web.1]: Process exited with status 1
2021-10-04T14:32:53.089213+00:00 heroku[web.1]: State changed from starting to crashed
edit: I understand it could be something with my packages, but on my side I see them as installed. Still at a loss!
You are using libraries that you didn't import into the package.json with npm.
Example: npm install express-session
Other thing that is wrong is to upload the .dotenv file to GitHub. Use the .gitignore to avoid it and configure the heroku envorinment variables. See more here: https://devcenter.heroku.com/articles/config-vars
Related
Run NPM Install
returncode: 126
stdout:
> zenitcouture#1.0.0 start /home/zenitcou/zenitcouture
> nodemon app.js
stderr:
npm WARN lifecycle The node binary used for scripts is /home/zenitcou/nodevenv/zenitcouture/10/bin/node but npm is using /opt/alt/alt-nodejs10/root/usr/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.
sh: /home/zenitcou/zenitcouture/node_modules/.bin/nodemon: Permission denied
npm ERR! code ELIFECYCLE
npm ERR! errno 126
npm ERR! zenitcouture#1.0.0 start: `nodemon app.js`
npm ERR! Exit status 126
npm ERR!
npm ERR! Failed at the zenitcouture#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/zenitcou/.npm/_logs/2021-10-09T17_17_22_982Z-debug.log
the above is my code. I'm trying to upload it to my cpanel and run it but i keep getting this error. I've stopped the app, and restarted it, the same error.
An error occured during installation of modules. The operation was performed, but check availability of application has failed. Web application responds, but its return code "500 Internal Server Error" or content type before operation "text/html; charset=UTF-8" doesn't equal to contet type after operation "text/html; charset=UTF-8".
i also get this error above if i dont stop the app before installing npm
I am attempting to build the starter api for the Grand Stack Starter, but it fails each time I attempt to use npm start:
>nodemon --exec babel-node src/index.js
[nodemon] 1.18.7
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `babel-node src/index.js`
'babel-node' is not recognized as an internal or external command,
operable program or batch file.
[nodemon] app crashed - waiting for file changes before starting...
Note, I did run npm i beforehand, and I can get other projects to run (including the UI project of the grand-stack-starter). I checked in the node_modules folder, and I indeed do not have the babel-node package, but when I to install it directly, it failed with:
> babel-node#6.5.3 postinstall [project_path]\api\node_modules\babel-node
> node message.js; sleep 10; exit 1;
internal/modules/cjs/loader.js:583
throw err;
^
Error: Cannot find module '[project_path]\api\node_modules\babel-node\message.js;'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
at Function.Module._load (internal/modules/cjs/loader.js:507:25)
at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
at startup (internal/bootstrap/node.js:282:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:743:3)
npm WARN grand-stack-starter-api#0.0.1 No repository field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! babel-node#6.5.3 postinstall: `node message.js; sleep 10; exit 1;`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the babel-node#6.5.3 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
I don't know if this is a problem specifically with my PC or not, but any help would be appreciated
Machine spec:
Fresh install of windows 10 home build 1803
I7-8750H
NPMv 6.4.1
Node.js v10.14.2
I re-installed Node.js and deleted the node_modules folder. After that I ran npm i and now npm start functions properly. It appears that the issue was with my environment after all.
I had similar issue when I tried with my laptop. but didn't get any such error when run the provided dockerfile in a docker container. This solved all such dependency package issues for me.
i want to deploy this application https://github.com/thefailtheory/neofreelance i am developping on my http://livecoding.tv channel
to heroku but i am facing an error
the application is basic it will try to solve a problem on freelancing in the cloud i use everyday
here is the log :
2016-11-22T16:20:34.454131+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2016-11-22T16:20:34.454297+00:00 app[web.1]: npm ERR! neofreelance#1.0.0 start: `node app.js`
2016-11-22T16:20:34.454450+00:00 app[web.1]: npm ERR! Exit status 1
2016-11-22T16:20:34.454616+00:00 app[web.1]: npm ERR!
2016-11-22T16:20:34.454772+00:00 app[web.1]: npm ERR! Failed at the neofreelance#1.0.0 start script 'node app.js'.
2016-11-22T16:20:34.454931+00:00 app[web.1]: npm ERR! Make sure you have the latest version of node.js and npm installed.
2016-11-22T16:20:34.455081+00:00 app[web.1]: npm ERR! If you do, this is most likely a problem with the neofreelance package,
2016-11-22T16:20:34.455232+00:00 app[web.1]: npm ERR! not with npm itself.
2016-11-22T16:20:34.455378+00:00 app[web.1]: npm ERR! Tell the author that this fails on your system:
2016-11-22T16:20:34.455537+00:00 app[web.1]: npm ERR! node app.js
2016-11-22T16:20:34.455684+00:00 app[web.1]: npm ERR! You can get information on how to open an issue for this project with:
2016-11-22T16:20:34.455833+00:00 app[web.1]: npm ERR! npm bugs neofreelance
2016-11-22T16:20:34.456007+00:00 app[web.1]: npm ERR! Or if that isn't available, you can get their info via:
2016-11-22T16:20:34.456156+00:00 app[web.1]: npm ERR! npm owner ls neofreelance
2016-11-22T16:20:34.456302+00:00 app[web.1]: npm ERR! There is likely additional logging output above.
2016-11-22T16:20:34.459887+00:00 app[web.1]:
2016-11-22T16:20:34.460174+00:00 app[web.1]: npm ERR! Please include the following file with any support request:
2016-11-22T16:20:34.460356+00:00 app[web.1]: npm ERR! /app/npm-debug.log
That is because Block-scoped declarations (let, const) are not yet supported in the Node version Heroku is using outside of strict mode.
So two options:
Add "use strict"; at the beginning of your file
Use var and not let.
so I am trying to deploy my nodejs application to heroku.
I have defined the start script in package.json
"scripts": {
"test": "./node_modules/.bin/mocha -r mocha-cakes",
"start": "rm -r -f database/test.db && node app.js",
"start-win": "del database\\test.db && node app.js"
}
I have also added web: rm -r -f database/test.db && node app.js to the Procfile
However my dyno still crashes with the following log error:
2016-06-25T12:27:58.216435+00:00 heroku[web.1]: Starting process with command `npm start`
2016-06-25T12:28:00.503447+00:00 app[web.1]: npm ERR! argv "/app/.heroku/node/bin/node" "/app/.heroku/node/bin/npm" "start"
2016-06-25T12:28:00.502867+00:00 app[web.1]: npm ERR! Linux 3.13.0-85-generic
2016-06-25T12:28:00.504156+00:00 app[web.1]: npm ERR! npm v3.8.6
2016-06-25T12:28:00.503707+00:00 app[web.1]: npm ERR! node v5.11.1
2016-06-25T12:28:00.506550+00:00 app[web.1]: npm ERR! missing script: start
2016-06-25T12:28:00.506746+00:00 app[web.1]: npm ERR!
2016-06-25T12:28:00.506912+00:00 app[web.1]: npm ERR! <https://github.com/npm/npm/issues>
2016-06-25T12:28:00.516583+00:00 app[web.1]:
2016-06-25T12:28:00.516795+00:00 app[web.1]: npm ERR! Please include the following file with any support request:
2016-06-25T12:28:00.516913+00:00 app[web.1]: npm ERR! /app/npm-debug.log
2016-06-25T12:28:00.506796+00:00 app[web.1]: npm ERR! If you need help, you may report this error at:
2016-06-25T12:28:00.505628+00:00 app[web.1]:
2016-06-25T12:28:01.445657+00:00 heroku[web.1]: Process exited with status 1
2016-06-25T12:28:01.461079+00:00 heroku[web.1]: State changed from starting to crashed
2016-06-25T12:28:01.461867+00:00 heroku[web.1]: State changed from crashed to starting
2016-06-25T12:28:04.433811+00:00 heroku[web.1]: Starting process with command `npm start`
I have checked with the other SO questions and none of the answers have solved my problem. I have tried everything that the other posts have recommended, but haven't found any success yet.
Here is the link to my repo if you want to see the source code.
In the /database/database.js file after creating the tables if those not exists, there is a db.run query that reads that XML file.
db.run('INSERT OR IGNORE INTO managers (username, password) VALUES ("admin","admin")', function(){
//
// Dear fellow coder:
//
// Once you are done trying to 'optimize' this routine,
// and have realized what a terrible mistake that was,
// please increment the following counter as a warning
// to the next guy:
//
// total_hours_wasted_here = 3
//
// When I wrote this, only God and I understood what I was doing
// Now, God only knows
//
// Magic, Do not touch
//initialise the table values from log file
// I want to read the xml file after the database tables have been created. HACK HACK!!!
$this.readLogFile();
console.log('Loaded Data from XML document');
});
I'm not sure what's the reason besides testing that you have this in your deployed code. I suppose the reason you want to delete the DB once deployed is that you only need it in testing.
Since Heroku does not seem to like rm -r -f database/test.db, I would suggest you to comment this out for deployment or as a more elegant solution add an if statement before calling this DB query that runs it only if you have a TESTING environment variable with a boolean value of true. You should also delete rm -r -f database/test.db from your start script.
The other problem with your approach is that the start script runs even before the XML file gets imported, so any manipulation with the db in the start script would not delete it.
Instead, you could also create a query that you call in app.js every time you start your server. That query should empty the whole DB. But why to read it and delete it, when you can just not read it at all.
This question already has answers here:
"message failed to fetch from registry" while trying to install any module
(15 answers)
Closed 8 years ago.
I am starting my first Node.js server. I am attempting to follow a tutorial in Node.js.
Having installed Node.js and executed npm install, the next instruction is to start the server by running node server.js which generates the following error:
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: Cannot find module 'express'
at Function._resolveFilename (module.js:332:11)
at Function._load (module.js:279:25)
at Module.require (module.js:354:17)
at require (module.js:370:17)
at Object.<anonymous> (/home/sisko/Desktop/ExerciseFiles/01/03/start/server.js:1:77)
at Module._compile (module.js:441:26)
at Object..js (module.js:459:10)
at Module.load (module.js:348:32)
at Function._load (module.js:308:12)
at Array.0 (module.js:479:10)
sisko#VirtualBox:~/Desktop/ExerciseFiles/01/03/start$
It seemed it needed a module called express so I looked around and found the npm install express command which should fix the issue. However, I get the following error:
sisko#VirtualBox:~/Desktop/ExerciseFiles/01/03/start$ npm install express
npm http GET https://registry.npmjs.org/express
npm ERR! Error: failed to fetch from registry: express
npm ERR! at /usr/share/npm/lib/utils/npm-registry-client/get.js:139:12
npm ERR! at cb (/usr/share/npm/lib/utils/npm-registry-client/request.js:31:9)
npm ERR! at Request._callback (/usr/share/npm/lib/utils/npm-registry-client/request.js:136:18)
npm ERR! at Request.callback (/usr/lib/nodejs/request/main.js:119:22)
npm ERR! at Request.<anonymous> (/usr/lib/nodejs/request/main.js:212:58)
npm ERR! at Request.emit (events.js:88:20)
npm ERR! at ClientRequest.<anonymous> (/usr/lib/nodejs/request/main.js:412:12)
npm ERR! at ClientRequest.emit (events.js:67:17)
npm ERR! at HTTPParser.onIncoming (http.js:1261:11)
npm ERR! at HTTPParser.onHeadersComplete (http.js:102:31)
npm ERR! You may report this log at:
npm ERR! <http://bugs.debian.org/npm>
npm ERR! or use
npm ERR! reportbug --attach /home/sisko/Desktop/ExerciseFiles/01/03/start/npm-debug.log npm
npm ERR!
npm ERR! System Linux 3.2.0-52-generic
npm ERR! command "node" "/usr/bin/npm" "install" "express"
npm ERR! cwd /home/sisko/Desktop/ExerciseFiles/01/03/start
npm ERR! node -v v0.6.12
npm ERR! npm -v 1.1.4
npm ERR! message failed to fetch from registry: express
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/sisko/Desktop/ExerciseFiles/01/03/start/npm-debug.log
npm not ok
Seems like it's a SSL certificate issue with the repository, because it worked with HTTP but not HTTPS.
For troubleshooting only
To troubleshoot, on a sandbox where you're okay running untrusted code, you can confirm this by trying the repository under HTTP this insecure hack: running npm config set registry http://registry.npmjs.org/ (or whaterver repo) then npm install express.
If that worked when the HTTPS doesn't, then it's probably an SSL issue.
Please do not use this insecure config as a fix. It's not a fix.
Installing from HTTP opens you up to running code from a malicious source.
The fix is to update node/npm versions and/or fix the SSL.
This helps as an alternative solution to accepted answer:
npm config set strict-ssl false
The problem with npm is that the default registry ssl certificate is not recognized properly.