I'm having a heap of trouble deploying my nodejs app to heroku. While it works perfectly for an initial build (to an empty application in heroku) any subsequent updates that I push fail.
I have defined the node version as "8.9.x", but if I define the exact version number of the latest version, it still fails - saying that "8.9.4" is not a valid semantic version.
If I take the engines section out of my package.json entirely, it tries to resolve "8.x" and then says that "8.x" isn't a valid semantic version!
Is there anything else that I could stuff up in my package.json to cause this? Or can anything outside the package.json be causing this?
Here's the output when pushing to the heroku git repo:
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Deleting 2 files matching .slugignore patterns.
remote: -----> Node.js app detected
remote:
remote: -----> Creating runtime environment
remote:
remote: NPM_CONFIG_LOGLEVEL=error
remote: NPM_CONFIG_PRODUCTION=true
remote: NODE_VERBOSE=false
remote: NODE_ENV=production
remote: NODE_MODULES_CACHE=true
remote:
remote: -----> Installing binaries
remote: engines.node (package.json): 8.9.x
remote: engines.npm (package.json): 5.6.x
remote:
remote: Resolving node version 8.9.x...
remote: Error: Invalid semantic version "8.9.x"
remote:
remote: -----> Build failed
remote:
remote: ! Invalid semver requirement
remote:
remote: Node, Yarn, and npm adhere to semver, the semantic versioning convention
remote: popularized by GitHub.
remote:
remote: http://semver.org/
remote:
remote: However you have specified a version requirement that is not a valid
remote: semantic version.
remote:
remote: https://kb.heroku.com/why-is-my-node-js-build-failing-because-of-an-invalid-semver-requirement
remote:
remote: ! Push rejected, failed to compile Node.js app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to [app name].
remote:
And here is my package.json
{
"name": "[REDACTED]",
"version": "3.4.4",
"description": "[REDACTED]",
"main": "index.js",
"engines": {
"node": "8.9.x",
"npm": "5.6.x"
},
"scripts": {
"test": "index.js",
"start": "node index.js"
},
"repository": {
"type": "git",
"url": "git+https://[REDACTED]"
},
"author": "jasonalex",
"license": "SEE LICENSE IN LICENSE",
"bugs": {
"url": "https://[REDACTED]"
},
"homepage": "https://[REDACTED]",
"dependencies": {
"#google-cloud/logging-winston": "^0.7.0",
"#google-cloud/storage": "^1.5.2",
"#google-cloud/trace-agent": "^2.4.1",
"body-parser": "^1.18.2",
"cors": "^2.8.4",
"cron": "^1.3.0",
"express": "^4.16.2",
"filereader": "^0.10.3",
"firebase-admin": "^5.8.1",
"jsonwebtoken": "^8.1.1",
"lodash": "^4.17.4",
"mailgun-js": "^0.14.2",
"moment": "^2.20.1",
"multer": "^1.3.0",
"pdfkit": "^0.8.3",
"pdfmake": "github:bpampuch/pdfmake",
"twilio": "^3.11.1",
"websocket-driver": ">=0.5.1",
"winston": "^2.4.0",
"xmlhttprequest": "^1.8.0"
},
"devDependencies": {
"babel-eslint": "^7.2.3",
"eslint": "^4.16.0",
"eslint-plugin-react": "^7.5.1",
"localtunnel": "^1.8.3"
}
}
Okay well I feel a bit silly now - in my case i had added a config var in my heroku settings called 'platform' which was interfering with the official nodejs buildpack.
Removing/renaming this variable has cleared the problem right up.
Related
I'm new to Heroku
I have been trying to deploy my app to Heroku but I'm having an issue which I can't resolve
My build passes and the app gets deployed but there is an error which I can't find nor resolve
I'm not really sure where to look nor what to look for since I'm literally too new to Heroku
Here is my build log
-----> Node.js app detected
-----> Creating runtime environment
NPM_CONFIG_LOGLEVEL=error
NODE_ENV=production
NODE_MODULES_CACHE=true
NODE_VERBOSE=false
-----> Installing binaries
engines.node (package.json): 12.x
engines.npm (package.json): 6.x
Resolving node version 12.x...
Downloading and installing node 12.18.3
Bootstrapping npm 6.x (replacing 6.14.6)...
npm 6.x installed
-----> Restoring cache
- node_modules
-----> Installing dependencies
Installing node modules
added 39 packages in 1.246s
-----> Build
-----> Caching build
- node_modules
-----> Pruning devDependencies
audited 39 packages in 0.584s
1 package is looking for funding
run `npm fund` for details
found 0 vulnerabilities
-----> Build succeeded!
-----> Discovering process types
Procfile declares types -> (none)
Default types for buildpack -> web
-----> Compressing...
Done: 23.4M
-----> Launching...
Released v5
https://ferit-virtual-classroom.herokuapp.com/ deployed to Heroku
And here is my package.json
{
"name": "ferit-bot",
"version": "1.0.0",
"description": "",
"publishConfig": { "registry": "https://npm.pkg.github.com/" },
"author": "JaVolimKatarinu",
"license": "ISC",
"dependencies": {
"discord.js": "^12.1.1",
"mysql2": "^2.1.0",
"node-fetch-npm": "^2.0.4"
},
"engines":{
"node": "12.x",
"npm": "6.x"
},
"scripts": {
"start": "main.js"
}
}
I have searched for a potential answer on Heroku support but without any luck
Thank you for reading and I would be really glad for a helpful answer
EDIT:All good, I have managed to deploy the app and its working
Thanks for help
The scripts in package-json file is not properly setup.
There must always be a start command which can be anything to be run in the terminal, but for yours, the script should be
"scripts": {
"start": "node main.js"
}
node keyword is ignored, thats why?
did you add a Procfile ?
web: node main.js
I'm getting
error: RPC failed; curl 56 LibreSSL SSL_read: SSL_ERROR_SYSCALL, errno 54
when I try to push to Heroku , this is not a first push I have this app deployed in Heroku already, but all of a sudden Heroku started throwing this error.
I have tried
setting git config --global http.postBuffer 524288000
restarting all dynos
deleting Heroku project and creating it again.
tried pushing same repo to GitHub and it works fine.
I'm using macos-catalina
here is the complete error
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Node.js app detected
remote:
remote: -----> Creating runtime environment
remote:
remote: NPM_CONFIG_LOGLEVEL=error
remote: NODE_ENV=production
remote: NODE_MODULES_CACHE=true
remote: NODE_VERBOSE=false
remote:
remote: -----> Installing binaries
remote: engines.node (package.json): unspecified
remote: engines.npm (package.json): unspecified (use default)
remote:
remote: Resolving node version 12.x...
remote: Downloading and installing node 12.18.3
remote: Using default npm version: 6.14.6
remote:
remote: -----> Restoring cache
remote: - node_modules
remote:
remote: -----> Installing dependencies
remote: Installing node modules
error: RPC failed; curl 56 LibreSSL SSL_read: SSL_ERROR_SYSCALL, errno 54
fatal: the remote end hung up unexpectedly
fatal: the remote end hung up unexpectedly
any help would be appreciated. thanks
In case any one is facing similar issues , check Heroku logs , in my case next.js build was taking too much memory so the deploy was getting rejected, eventhough push was success.
I'm trying to use React Frontend and Go Backend language.
I have to Go installed locally and I can run commands like go run main.go or go build. But when I try to push to Heroku, I get the following error:
$ rm -rf index && go build -o index
remote: /bin/sh: 1: go: not found
remote: error Command failed with exit code 127.
remote: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
remote: error Command failed with exit code 127.
remote: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
remote:
remote: -----> Build failed
This is my package.json:
{
"name": "fullstack-course",
"version": "1.0.0",
"description": "",
"main": "index.go",
"scripts": {
"client": "rm -rf build/ && webpack --env.mode production",
"server": "rm -rf index && go build -o index",
"start": "./index",
"heroku-postbuild": "yarn run client && yarn run server"
},
"engines": {
"node": "10.x",
"npm": "6.9.x",
"yarn": "1.x"
},
"repository": {
"type": "git",
},
"author": "",
"license": "ISC",
"dependencies": {...}
}
Why when running locally it works, but when pushing it to Heroku it fails?
How can I fix this?
Thanks
I'm trying to host my adonis JS project on heroku.
I followed https://medium.com/#mazinosukah/how-to-deploy-adonisjs-apps-to-heroku-66741e7cd26f and https://scotch.io/tutorials/deploying-adonisjs-apps-to-heroku but I ran into an error not described in those sites. (The webapp runs fine locally)
After running git push heroku herokuMaster:master
I get:
Counting objects: 1, done.
Writing objects: 100% (1/1), 198 bytes | 99.00 KiB/s, done.
Total 1 (delta 0), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Node.js app detected
remote:
remote: -----> Creating runtime environment
remote:
remote: NPM_CONFIG_LOGLEVEL=error
remote: NODE_ENV=production
remote: NODE_MODULES_CACHE=true
remote: NODE_VERBOSE=false
remote:
remote: -----> Installing binaries
remote: engines.node (package.json): 10.13.0
remote: engines.npm (package.json): unspecified (use default)
remote:
remote: Resolving node version 10.13.0...
remote: Downloading and installing node 10.13.0...
remote: Using default npm version: 6.4.1
remote:
remote: -----> Building dependencies
remote: Installing node modules (package.json)
remote: added 510 packages from 288 contributors and audited 4026 packages in 15.432s
remote: found 0 vulnerabilities
remote:
remote:
remote: -----> Caching build
remote: - node_modules
remote:
remote: -----> Pruning devDependencies
remote: audited 4026 packages in 3.961s
remote: found 0 vulnerabilities
remote:
remote:
remote: -----> Build succeeded!
remote: -----> Discovering process types
remote: Procfile declares types -> release, web
remote:
remote: -----> Compressing...
remote: Done: 24.4M
remote: -----> Launching...
remote: ! Release command declared: this new release will not be available until the command succeeds.
remote: Released v9
remote: https://myappname.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy... done.
remote: Running release command...
remote:
remote:
remote: TypeError: Cannot read property 'name' of undefined
remote:
remote:
remote: 1 _.transform
remote: /app/node_modules/#adonisjs/ace/src/Command/index.js:527
remote:
remote: 2 anonymous
remote: /app/node_modules/lodash/lodash.js:13807
remote:
remote: 3 arrayEach
remote: /app/node_modules/lodash/lodash.js:516
remote:
remote: 4 Function.transform
remote: /app/node_modules/lodash/lodash.js:13806
remote:
remote: 5 Function.commanderAction
remote: /app/node_modules/#adonisjs/ace/src/Command/index.js:526
remote:
remote: 6 Command.listener
remote: /app/node_modules/commander/index.js:315
remote:
remote: 7 Command.parseArgs
remote: /app/node_modules/commander/index.js:654
remote:
remote: 8 Command.parse
remote: /app/node_modules/commander/index.js:474
remote:
remote: 9 Kernel.invoke
remote: /app/node_modules/#adonisjs/ace/src/Kernel/index.js:329
remote:
remote: 10 Ignitor._invokeAce
remote: /app/node_modules/#adonisjs/ignitor/src/Ignitor/index.js:532
remote:
remote: 11 Ignitor.fireAce
remote: /app/node_modules/#adonisjs/ignitor/src/Ignitor/index.js:847
remote:
remote: Waiting for release.... failed.
I'm not sure why it is complaining about files in node_modules...
Any ideas? I can share more code if necessary.
I changed my Procfile contents from
release: ENV_SILENT=true node ace migration:run — force
web: ENV_SILENT=true npm start
to
web: ENV_SILENT=true npm start
The issue is a typo with the force flag. I updated the Procfile to the following and it worked:
release: ENV_SILENT=true node ace migration:run --force
web: ENV_SILENT=true npm start
i'm trying to host my website through heroku, but the build is failing constantly whatever i do.The build works locally, but when i tried to push to heroku i keep getting this
Counting objects: 1324, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (609/609), done.
Writing objects: 100% (1324/1324), 28.24 MiB | 0 bytes/s, done.
Total 1324 (delta 681), reused 1324 (delta 681)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Node.js app detected
remote:
remote: -----> Creating runtime environment
remote:
remote: NPM_CONFIG_LOGLEVEL=error
remote: NODE_VERBOSE=false
remote: NODE_ENV=production
remote: NODE_MODULES_CACHE=true
remote:
remote: -----> Installing binaries
remote: engines.node (package.json): ^10.7
remote: engines.npm (package.json): unspecified (use default)
remote: engines.yarn (package.json): ^1.5
remote:
remote: Resolving node version ^10.7...
remote: Downloading and installing node 10.9.0...
remote: Using default npm version: 6.2.0
remote: Resolving yarn version ^1.5...
remote: Downloading and installing yarn (1.9.4)...
remote: Installed yarn 1.9.4
remote:
remote: -----> Restoring cache
remote: Skipping cache restore (not-found)
remote:
remote: -----> Building dependencies
remote: Installing node modules (yarn.lock)
remote: yarn install v1.9.4
remote: [1/4] Resolving packages...
remote: [2/4] Fetching packages...
remote: warning Pattern ["#types/koa#latest"] is trying to unpack in the same destination "/tmp/yarncache.80EhH/v2/npm-#types/koa-2.0.46-24bc3cd405d10fcde81f876cd8285
b44d4ddc3e9" as pattern ["#types/koa#*","#types/koa#*","#types/koa#*","#types/koa#*","#types/koa#*","#types/koa#*","#types/koa#*","#types/koa#*","#types/koa#*"]. This could
result in non-deterministic behavior, skipping.
remote: warning Pattern ["#types/node#latest"] is trying to unpack in the same destination "/tmp/yarncache.80EhH/v2/npm-#types/node-10.9.2-f0ab8dced5cd6c56b26765e1c0d
9e4fdcc9f2a00" as pattern ["#types/node#*","#types/node#*","#types/node#*","#types/node#*","#types/node#*","#types/node#*","#types/node#*","#types/node#*","#types/node#*","#
types/node#*","#types/node#*","#types/node#*","#types/node#*","#types/node#*","#types/node#*"]. This could result in non-deterministic behavior, skipping.
remote: warning Pattern ["koa-convert#latest"] is trying to unpack in the same destination "/tmp/yarncache.80EhH/v2/npm-koa-convert-1.2.0-da40875df49de0539098d1700b50
820cebcd21d0" as pattern ["koa-convert#^1.2.0"]. This could result in non-deterministic behavior, skipping.
remote: warning Pattern ["qs#latest"] is trying to unpack in the same destination "/tmp/yarncache.80EhH/v2/npm-qs-6.5.2-cb3ae806e8740444584ef154ce8ee98d403f3e36" as p
attern ["qs#^6.4.0"]. This could result in non-deterministic behavior, skipping.
remote: (node:257) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or
Buffer.from() methods instead.
remote: [1/4] Resolving packages...
remote: [2/4] Fetching packages...
remote: error An unexpected error occurred: "ENOENT: no such file or directory, scandir '/tmp/yarncache.80EhH/v2/npm-path-key-2.0.1-411cadb574c5a140d3a4b1910d40d80cc9
f40b40'".
remote: info If you think this is a bug, please open a bug report with the information provided in "/tmp/build_11ee5794ef73ae92c415ea71c412314f/yarn-error.log".
remote: info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
remote:
remote: -----> Build failed
remote:
remote: We're sorry this build is failing! You can troubleshoot common issues here:
remote: https://devcenter.heroku.com/articles/troubleshooting-node-deploys
remote:
remote: If you're stuck, please submit a ticket so we can help:
remote: https://help.heroku.com/
remote:
remote: Love,
remote: Heroku
remote:
remote: ! Push rejected, failed to compile Node.js app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to sun-it-solution.
remote:
To https://git.heroku.com/sun-it-solution.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/sun-it-solution.git'
i also tried to run yarn cache clean, removing all node_modules and run yarn install , but still the build fails
i'm stuck here :( i googled some other things too but i cant solve the problem please help