i am using heroku and my server is written in Node JS.
while trying
git push heroku master
I am am getting the following Error
remote: Building source:
remote:
remote: -----> Node.js app detected
remote:
remote: -----> Creating runtime environment
remote:
remote: NPM_CONFIG_LOGLEVEL=error
remote: NPM_CONFIG_PRODUCTION=true
remote: NODE_ENV=production
remote: NODE_MODULES_CACHE=true
remote:
remote: -----> Installing binaries
remote: engines.node (package.json): 4.1.2
remote: engines.npm (package.json): unspecified (use default)
remote:
remote: Downloading and installing node 4.1.2...
remote: Using default npm version: 2.14.4
remote:
remote: -----> Restoring cache
remote: Skipping cache restore (new runtime signature)
remote:
remote: -----> Building dependencies
remote: Pruning any extraneous modules
remote: Installing node modules (package.json)
remote: npm ERR! Linux 3.13.0-85-generic
remote: npm ERR! argv "/tmp/build_a220092b4f1662f47548204bbda7d972/.heroku/node/bin/node" "/tmp/build_a220092b4f1662f47548204bbda7d972/.heroku/
node/bin/npm" "install" "--unsafe-perm" "--userconfig" "/tmp/build_a220092b4f1662f47548204bbda7d972/.npmrc"
remote: npm ERR! node v4.1.2
remote: npm ERR! npm v2.14.4
remote:
remote: npm ERR! version not found: e#2.7.1
remote: npm ERR!
remote: npm ERR! If you need help, you may report this error at:
remote: npm ERR! <https://github.com/npm/npm/issues>
remote:
remote: npm ERR! Please include the following file with any support request:
remote: npm ERR! /tmp/build_a220092b4f1662f47548204bbda7d972/npm-debug.log
my package.json file looks like this
{
"name": "myServerTry",
"version": "1.0.0",
"description": "InfoBroker application",
"engines": {
"node": "4.1.2"
},
"main": "server.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node server.js"
},
"dependencies": {
"body-parser": "^1.14.1",
"connect": "^3.4.0",
"cors": "^2.7.1",
"express": "^4.13.3",
"express-csv": "^0.6.0",
"foobar": "^1.1.0",
"e": "^0.0.4",
"mysql": "^2.9.0",
"q": "^1.4.1",
"qs": "^6.0.0",
"underscore": "^1.8.3"
},
"keywords": [],
"author": "",
"license": "ISC"
}
In my local files, everything is working just fine.
I also checked the version of the dependencies and it is all right.
any ideas?
Related
remote: -----> Installing dependencies
remote: Installing node modules
remote: npm ERR! code ERESOLVE
remote: npm ERR! ERESOLVE could not resolve
remote: npm ERR!
remote: npm ERR! While resolving: react-rss#2.0.1
remote: npm ERR! Found: react#18.2.0
remote: npm ERR! node_modules/react
remote: npm ERR! react#"^18.2.0" from the root project
remote: npm ERR! peer react#"^18.0.0" from #testing-library/react#13.4.0
remote: npm ERR! node_modules/#testing-library/react
remote: npm ERR! #testing-library/react#"^13.4.0" from the root project
remote: npm ERR! 4 more (react-dom, react-router, react-router-dom, react-scripts)
remote: npm ERR!
remote: npm ERR! Could not resolve dependency:
remote: npm ERR! peer react#"^16.13.1" from react-rss#2.0.1
remote: npm ERR! node_modules/react-rss
remote: npm ERR! react-rss#"^2.0.1" from the root project
remote: npm ERR!
remote: npm ERR! Conflicting peer dependency: react#16.14.0
remote: npm ERR! node_modules/react
remote: npm ERR! peer react#"^16.13.1" from react-rss#2.0.1
remote: npm ERR! node_modules/react-rss
remote: npm ERR! react-rss#"^2.0.1" from the root project
remote: npm ERR!
remote: npm ERR! Fix the upstream dependency conflict, or retry
remote: npm ERR! this command with --force, or --legacy-peer-deps
remote: npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
remote: npm ERR!
remote: npm ERR! See /tmp/npmcache.zVSUf/eresolve-report.txt for a full report.
remote:
remote: npm ERR! A complete log of this run can be found in:
remote: npm ERR! /tmp/npmcache.zVSUf/_logs/2022-11-03T19_15_38_788Z-debug-0.log
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: Some possible problems:
remote:
remote: - Node version not specified in package.json
remote: https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version
remote:
remote: Love,
remote: Heroku
remote:
remote: ! Push rejected, failed to compile Node.js app.
remote:
remote: ! Push failed
remote: !
remote: ! ## Warning - The same version of this code has already been built: ea132e7d82ff4a3fe3121b0858e49a2c8336bec0
remote: !
remote: ! We have detected that you have triggered a build from source code with version ea132e7d82ff4a3fe3121b0858e49a2c8336bec0
remote: ! at least twice. One common cause of this behavior is attempting to deploy code from a different branch.
remote: !
remote: ! If you are developing on a branch and deploying via git you must run:
remote: !
remote: ! git push heroku <branchname>:main
remote: !
remote: ! This article goes into details on the behavior:
remote: ! https://devcenter.heroku.com/articles/duplicate-build-version
remote:
remote: Verifying deploy...
remote:
remote: ! Push rejected to tb-work-hub.
remote:
To https://git.heroku.com/tb-work-hub.git
! [remote rejected] master -> master (pre-receive hook declined)
I don't understand this. It was working just fine yesterday. I'm guessing it's to do with some dependencies I was trying to work with?
If there isn't a clean solution, is there a good way to restore my app without having to start fresh, reinstall everything and copy-paste the src?
Tried: npm uninstall react-rss
Go to the app in Heroku -> settings -> Reveal Config Vars
Add a new config var with the key: NPM_CONFIG_LEGACY_PEER_DEPS and value true, and then redeploy.
(Heroku Shopify Application Error 'npm ERR! ERESOLVE unable to resolve dependency tree')
I hope it works.
this was perfectly fine until i added a server to my cleint that was running with buildpacks mars/...
I made sure to remove all buildpacks with buildpacks:remove mars/...
I also tried heroku buildpacks:set heroku/nodejs
I also tried the git push heroku main:main
I am not sure but i think it maybe something with permissions but i may be wrong since i am new to heroku.
git push heroku main
Enumerating objects: 74, done.
Counting objects: 100% (74/74), done.
Delta compression using up to 12 threads
Compressing objects: 100% (53/53), done.
Writing objects: 100% (68/68), 290.70 KiB | 58.14 MiB/s, done.
Total 68 (delta 15), reused 62 (delta 13), pack-reused 0
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Building on the Heroku-20 stack
remote: -----> Determining which buildpack to use for this app
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): 12.16.2
remote: engines.npm (package.json): 6.14.6
remote:
remote: Resolving node version 12.16.2...
remote: Downloading and installing node 12.16.2...
remote: Bootstrapping npm 6.14.6 (replacing 6.14.4)...
remote: npm 6.14.6 installed
remote:
remote: -----> Restoring cache
remote: Cached directories were not restored due to a change in version of node, npm, yarn or stack
remote: Module installation may take longer for this build
remote:
remote: -----> Installing dependencies
remote: Installing node modules
remote:
remote: > fsevents#1.2.13 install /tmp/build_ff6289e7/node_modules/fsevents
remote: > node install.js
remote:
remote:
remote: Skipping 'fsevents' build as platform linux is not supported
remote:
remote: > nodemon#1.19.4 postinstall /tmp/build_ff6289e7/node_modules/nodemon
remote: > node bin/postinstall || exit 0
remote:
remote: Love nodemon? You can now support the project via the open collective:
remote: > https://opencollective.com/nodemon/donate
remote:
remote: added 375 packages in 6.258s
remote:
remote: -----> Build
remote: Detected both "build" and "heroku-postbuild" scripts
remote: Running heroku-postbuild
remote:
remote: > everestminds-task#1.0.0 heroku-postbuild /tmp/build_ff6289e7
remote: > cd client && npm install && npm install --only=dev --no-shrinkwrap && npm run build
remote:
remote:
remote: > node-sass#6.0.1 install /tmp/build_ff6289e7/client/node_modules/node-sass
remote: > node scripts/install.js
remote:
remote: Downloading binary from https://github.com/sass/node-sass/releases/download/v6.0.1/linux-x64-72_binding.node
remote: Download complete
remote: Binary saved to /tmp/build_ff6289e7/client/node_modules/node-sass/vendor/linux-x64-72/binding.node
remote: Caching binary to /tmp/npmcache.vnweW/node-sass/6.0.1/linux-x64-72_binding.node
remote:
remote: > core-js#3.6.5 postinstall /tmp/build_ff6289e7/client/node_modules/#firebase/polyfill/node_modules/core-js
remote: > node -e "try{require('./postinstall')}catch(e){}"
remote:
remote:
remote: > core-js#2.6.12 postinstall /tmp/build_ff6289e7/client/node_modules/babel-runtime/node_modules/core-js
remote: > node -e "try{require('./postinstall')}catch(e){}"
remote:
remote:
remote: > core-js#3.14.0 postinstall /tmp/build_ff6289e7/client/node_modules/core-js
remote: > node -e "try{require('./postinstall')}catch(e){}"
remote:
remote:
remote: > core-js-pure#3.14.0 postinstall /tmp/build_ff6289e7/client/node_modules/core-js-pure
remote: > node -e "try{require('./postinstall')}catch(e){}"
remote:
remote:
remote: > ejs#2.7.4 postinstall /tmp/build_ff6289e7/client/node_modules/ejs
remote: > node ./postinstall.js
remote:
remote:
remote: > protobufjs#6.11.2 postinstall /tmp/build_ff6289e7/client/node_modules/protobufjs
remote: > node scripts/postinstall
remote:
remote:
remote: > node-sass#6.0.1 postinstall /tmp/build_ff6289e7/client/node_modules/node-sass
remote: > node scripts/build.js
remote:
remote: Binary found at /tmp/build_ff6289e7/client/node_modules/node-sass/vendor/linux-x64-72/binding.node
remote: Testing binary
remote: Binary is fine
remote: added 2146 packages from 876 contributors and audited 2150 packages in 55.156s
remote:
remote: 151 packages are looking for funding
remote: run npm fund for details
remote:
remote: found 7 vulnerabilities (3 moderate, 4 high)
remote: run npm audit fix to fix them, or npm audit for details
remote: audited 2150 packages in 14.59s
remote:
remote: 151 packages are looking for funding
remote: run npm fund for details
remote:
remote: found 7 vulnerabilities (3 moderate, 4 high)
remote: run npm audit fix to fix them, or npm audit for details
remote:
remote: > everestminds-task#0.1.0 build /tmp/build_ff6289e7/client
remote: > react-scripts build
remote:
remote: Creating an optimized production build...
remote: Failed to compile.
remote:
remote: Can't find self.__WB_MANIFEST in your SW source.
remote:
remote:
remote: npm ERR! code ELIFECYCLE
remote: npm ERR! errno 1
remote: npm ERR! everestminds-task#0.1.0 build: react-scripts build
remote: npm ERR! Exit status 1
remote: npm ERR!
remote: npm ERR! Failed at the everestminds-task#0.1.0 build script.
remote: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
remote:
remote: npm ERR! A complete log of this run can be found in:
remote: npm ERR! /tmp/npmcache.vnweW/_logs/2021-06-27T21_07_28_897Z-debug.log
remote: npm ERR! code ELIFECYCLE
remote: npm ERR! errno 1
remote: npm ERR! everestminds-task#1.0.0 heroku-postbuild: cd client && npm install && npm install --only=dev --no-shrinkwrap && npm run build
remote: npm ERR! Exit status 1
remote: npm ERR!
remote: npm ERR! Failed at the everestminds-task#1.0.0 heroku-postbuild script.
remote: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
remote:
remote: npm ERR! A complete log of this run can be found in:
remote: npm ERR! /tmp/npmcache.vnweW/_logs/2021-06-27T21_07_28_915Z-debug.log
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: !
remote: ! ## Warning - The same version of this code has already been built: 2c4fee55f03ca310626cd12afa9d269f1d95cc34
remote: !
remote: ! We have detected that you have triggered a build from source code with version 2c4fee55f03ca310626cd12afa9d269f1d95cc34
remote: ! at least twice. One common cause of this behavior is attempting to deploy code from a different branch.
remote: !
remote: ! If you are developing on a branch and deploying via git you must run:
remote: !
remote: ! git push heroku :main
remote: !
remote: ! This article goes into details on the behavior:
remote: ! https://devcenter.heroku.com/articles/duplicate-build-version
remote:
remote: Verifying deploy...
remote:
remote: ! Push rejected to everestminds-task.
remote:
To https://git.heroku.com/everestminds-task.git
! [remote rejected] main -> main (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/everestminds-task.git'
server package.json
{
"name": "everestminds-task",
"version": "1.0.0",
"engines": {
"node": "12.16.2",
"npm": "6.14.6"
},
"scripts": {
"client": "cd client && npm start",
"server": "nodemon server.js",
"build": "cd client && npm run build",
"dev": "concurrently --kill-others-on-fail \"npm run server\" \"npm run client\"",
"start": "node server.js",
"heroku-postbuild": "cd client && npm install && npm install --only=dev --no-shrinkwrap && npm run build"
},
"dependencies": {
"body-parser": "^1.18.3",
"cors": "2.8.5",
"dotenv": "7.0.0",
"express": "^4.16.4",
"stripe": "6.28.0"
},
"devDependencies": {
"concurrently": "^4.0.1",
"nodemon": "^1.19.1"
}
}
Client package.json
{
"name": "everestminds-task",
"version": "0.1.0",
"private": true,
"proxy": "http://localhost:5000",
"dependencies": {
"#testing-library/jest-dom": "^5.14.1",
"#testing-library/react": "^11.2.7",
"#testing-library/user-event": "^12.8.3",
"axios": "^0.21.1",
"express-sslify": "^1.2.0",
"firebase": "^8.6.8",
"node-sass": "^6.0.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-redux": "^7.2.4",
"react-router-dom": "^5.2.0",
"react-scripts": "4.0.3",
"react-stripe-checkout": "^2.6.3",
"redux": "^4.1.0",
"redux-logger": "^3.0.6",
"redux-persist": "^6.0.0",
"reselect": "^4.0.0",
"styled-components": "^5.3.0",
"web-vitals": "^1.1.2"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
thanks for the help in advance
Alright, for anyone who comes across this. I found the problem, it was the serviceworker.js... it seems that "Can't find self.__WB_MANIFEST in your SW source" has something to do with it.
create-react-app no longer comes with service-worker.js. So it maybe that I need to install a package that "swSrc" or something I am not sure yet.
I have been trying to deploy my app on heroku but i keep getting the same error:
-----> Node.js app detected
-----> Creating runtime environment
NPM_CONFIG_LOGLEVEL=error
NODE_VERBOSE=false
NODE_ENV=production
NODE_MODULES_CACHE=true
-----> Installing binaries
engines.node (package.json): unspecified
engines.npm (package.json): unspecified (use default)
Resolving node version 8.x...
Downloading and installing node 8.11.1...
Using default npm version: 5.6.0
-----> Restoring cache
Skipping cache restore (not-found)
-----> Building dependencies
Prebuild detected (node_modules already exists)
Rebuilding any native modules
npm ERR! path /tmp/build_b970b614b48136e1f3dc8a90ee8f11d9/node_modules/har-validator/bin/har-validator
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall chmod
npm ERR! enoent ENOENT: no such file or directory, chmod '/tmp/build_b970b614b48136e1f3dc8a90ee8f11d9/node_modules/har-validator/bin/har-validator'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! /tmp/npmcache.wtPoJ/_logs/2018-05-02T14_48_40_930Z-debug.log
-----> Build failed
We're sorry this build is failing! You can troubleshoot common issues here:
https://devcenter.heroku.com/articles/troubleshooting-node-deploys
Some possible problems:
- node_modules checked into source control
https://blog.heroku.com/node-habits-2016#9-only-git-the-important-bits
- Node version not specified in package.json
https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version
Love,
Heroku
! Push rejected, failed to compile Node.js app.
! Push failed
The app runs fine in localhost if I run npm i then npm start, I have tried to completely rebuild my package.json, I have tried to completely delete the heroku app and recreate one, nothing seems to help.
My package.json looks like this, the most standard possible:
{
"name": "LAD",
"version": "1.0.0",
"description": "xxxxx",
"repository": "git://github.com/xxx/xxx-LAD",
"author": "xxxx",
"license": "xxxxx",
"scripts": {
"start": "node ./bin/www"
},
"dependencies": {
"body-parser": "^1.18.2",
"bootstrap": "^3.3.7",
"compile-sass": "0.0.3",
"connect-ensure-login": "^0.1.1",
"connect-flash": "^0.1.1",
"cookie-parser": "^1.4.3",
"ejs": "^2.5.9",
"express": "^4.16.3",
"express-session": "^1.15.6",
"morgan": "^1.9.0",
"passport": "^0.4.0",
"passport-auth0": "^0.6.1",
"path": "^0.12.7",
"serve-favicon": "^2.5.0"
}
}
Did you try adding node_modules to your .gitignore file and checking in the gitignore file?
I am assuming Heroku is complaining because it's trying to install the node_modules but it already sees a folder called node_modules in the same location.
I'm doing the walkthrough in this book, building a Rails API app with Angular 2 on top. Github
Using two buildpacks as instructed in Angular For Rails Developer book.
heroku buildpacks:add https://github.com/jasonswett/heroku-buildpack-nodejs
heroku buildpacks:add heroku/ruby
All of my updates have been checked in. When I git push heroku master, I get the following error printout
remote: Running heroku-postbuild
remote:
remote: > author-wizard#0.0.0 heroku-postbuild /tmp/build_6cac525cd409f823d4d8849a2cb7eba2/client
remote: > ng build
remote:
remote: Could not start watchman; falling back to NodeWatcher for file system events.
remote: Visit http://ember-cli.com/user-guide/#watchman for more info.
33% building modules 19events.js:160
remote: throw er; // Unhandled 'error' event
remote: ^
remote:
remote: Error: This socket is closed
remote: at Socket._writeGeneric (net.js:673:19)
remote: at Socket._write (net.js:724:8)
remote: at doWrite (_stream_writable.js:307:12)
remote: at writeOrBuffer (_stream_writable.js:293:5)
remote: at Socket.Writable.write (_stream_writable.js:220:11)
remote: at Socket.write (net.js:651:40)
remote: at Socket.process.stderr.write (/tmp/build_6cac525cd409f823d4d8849a2cb7eba2/client/node_modules/angular-c
li/lib/cli/index.js:30:27)
remote: at Console.warn (console.js:51:16)
remote: at printErrorAndExit (/tmp/build_6cac525cd409f823d4d8849a2cb7eba2/client/node_modules/awesome-typescript-
loader/node_modules/source-map-support/source-map-support.js:406:11)
remote: at process.emit (/tmp/build_6cac525cd409f823d4d8849a2cb7eba2/client/node_modules/awesome-typescript-loade
r/node_modules/source-map-support/source-map-support.js:419:16)
remote: at process._fatalException (bootstrap_node.js:296:26)
remote:
remote: npm ERR! Linux 3.13.0-100-generic
remote: npm ERR! argv "/tmp/build_6cac525cd409f823d4d8849a2cb7eba2/client/.heroku/node/bin/node" "/tmp/build_6cac525c
d409f823d4d8849a2cb7eba2/client/.heroku/node/bin/npm" "run" "heroku-postbuild" "--if-present"
remote: npm ERR! node v6.6.0
remote: npm ERR! npm v3.10.3
remote: npm ERR! code ELIFECYCLE
remote: npm ERR! author-wizard#0.0.0 heroku-postbuild: `ng build`
remote: npm ERR! Exit status 7
remote: npm ERR!
remote: npm ERR! Failed at the author-wizard#0.0.0 heroku-postbuild script 'ng build'.
remote: npm ERR! Make sure you have the latest version of node.js and npm installed.
remote: npm ERR! If you do, this is most likely a problem with the author-wizard package,
remote: npm ERR! not with npm itself.
remote: npm ERR! Tell the author that this fails on your system:
remote: npm ERR! ng build
remote: npm ERR! You can get information on how to open an issue for this project with:
remote: npm ERR! npm bugs author-wizard
remote: npm ERR! Or if that isn't available, you can get their info via:
remote: npm ERR! npm owner ls author-wizard
remote: npm ERR! There is likely additional logging output above.
remote:
remote: npm ERR! Please include the following file with any support request:
remote: npm ERR! /tmp/build_6cac525cd409f823d4d8849a2cb7eba2/client/npm-debug.log
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 evening-castle-95407.
remote:
To https://git.heroku.com/evening-castle-95407.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/evening-castle-95407.git'
My package.json looks like this:
{
"name": "author-wizard",
"version": "0.0.0",
"engines": {
"node": "6.6.0",
"npm": "3.10.3"
},
"license": "MIT",
"angular-cli": {},
"scripts": {
"lint": "tslint \"src/**/*.ts\"",
"test": "ng test",
"pree2e": "webdriver-manager update",
"e2e": "protractor",
"preinstall": "npm install -g node-gyp",
"heroku-postbuild": "ng build"
},
"private": true,
"dependencies": {
"#angular/common": "~2.0.0",
"#angular/compiler": "~2.0.0",
"#angular/core": "~2.0.0",
"#angular/forms": "~2.0.0",
"#angular/http": "~2.0.0",
"#angular/platform-browser": "~2.0.0",
"#angular/platform-browser-dynamic": "~2.0.0",
"#angular/router": "~3.0.0",
"core-js": "^2.4.1",
"rxjs": "5.0.0-beta.12",
"ts-helpers": "^1.1.1",
"zone.js": "^0.6.23",
"#types/jasmine": "^2.2.30",
"#types/node": "^6.0.42",
"angular-cli": "1.0.0-beta.17",
"codelyzer": "~0.0.26",
"jasmine-core": "2.4.1",
"jasmine-spec-reporter": "2.5.0",
"karma": "1.2.0",
"karma-chrome-launcher": "^2.0.0",
"karma-cli": "^1.0.1",
"karma-jasmine": "^1.0.2",
"karma-remap-istanbul": "^0.2.1",
"protractor": "4.0.9",
"ts-node": "1.2.1",
"tslint": "3.13.0",
"typescript": "2.0.2"
},
"devDependencies": {
}
}
The only thing I added that wasn't in the tutorial was the engine definitions, but Heroku was saying to put that in (to match my local versions) if I had problems deploying.
"engines": {
"node": "6.6.0",
"npm": "3.10.3"
},
Any tips on how to move forward with deployment would be awesome. Thanks!
Update
changed package.json from
"heroku-postbuild": "ng build"
to
"heroku-postbuild": "ng build -prod"
And it deployed fine. Still having other issues w Uglifier gem but this issue is addressed. Thanks #jasonswett
I have generated my angualr2 app using ng new project command, and now i am trying to put my project on heroku, unfortunatly, I faced with an error when i pushed my code with git push heroku master:
Counting objects: 65, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (62/62), done.
Writing objects: 100% (65/65), 363.09 KiB | 0 bytes/s, done.
Total 65 (delta 5), 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: NPM_CONFIG_PRODUCTION=true
remote: NODE_ENV=production
remote: NODE_MODULES_CACHE=true
remote:
remote: -----> Installing binaries
remote: engines.node (package.json): unspecified
remote: engines.npm (package.json): unspecified (use default)
remote:
remote: Resolving node version (latest stable) via semver.io...
remote: Downloading and installing node 5.11.1...
remote: Using default npm version: 3.8.6
remote:
remote: -----> Restoring cache
remote: Skipping cache restore (new runtime signature)
remote:
remote: -----> Building dependencies
remote: Installing node modules (package.json)
remote:
remote: > qminder#0.0.0 postinstall /tmp/build_a0673d10d05036142a147f64099bd6fb
remote: > typings install
remote:
remote: sh: 1: typings: not found
remote:
remote: npm ERR! Linux 3.13.0-91-generic
remote: npm ERR! argv "/tmp/build_a0673d10d05036142a147f64099bd6fb/.heroku/node/bin/node" "/tmp/build_a0673d10d05036142a147f64099bd6fb/.heroku/node/bin/npm" "install" "--unsafe-perm" "--userconfig" "/tmp/build_a0673d10d05036142a147f64099bd6fb/.npmrc"
remote: npm ERR! node v5.11.1
remote: npm ERR! npm v3.8.6
remote: npm ERR! file sh
remote: npm ERR! code ELIFECYCLE
remote: npm ERR! errno ENOENT
remote: npm ERR! syscall spawn
remote: npm ERR! qminder#0.0.0 postinstall: `typings install`
remote: npm ERR! spawn ENOENT
remote: npm ERR!
remote: npm ERR! Failed at the qminder#0.0.0 postinstall script 'typings install'.
remote: npm ERR! Make sure you have the latest version of node.js and npm installed.
remote: npm ERR! If you do, this is most likely a problem with the qminder package,
remote: npm ERR! not with npm itself.
remote: npm ERR! Tell the author that this fails on your system:
remote: npm ERR! typings install
remote: npm ERR! You can get information on how to open an issue for this project with:
remote: npm ERR! npm bugs qminder
remote: npm ERR! Or if that isn't available, you can get their info via:
remote: npm ERR! npm owner ls qminder
remote: npm ERR! There is likely additional logging output above.
remote:
remote: npm ERR! Please include the following file with any support request:
remote: npm ERR! /tmp/build_a0673d10d05036142a147f64099bd6fb/npm-debug.log
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: Some possible problems:
remote:
remote: - Node version not specified in package.json
remote: https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version
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 easy-instagram.
remote:
To https://git.heroku.com/easy-instagram.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/easy-instagram.git'
So, is there anything that i can add to my project to fix this problem?
I have mannually added the node version to my config.json file, but it still complains with the same error:
"devDependencies": {
"angular-cli": "1.0.0-beta.10",
"codelyzer": "0.0.20",
"ember-cli-inject-live-reload": "1.4.0",
"jasmine-core": "2.4.1",
"jasmine-spec-reporter": "2.5.0",
"karma": "0.13.22",
"karma-chrome-launcher": "0.2.3",
"karma-jasmine": "0.3.8",
"protractor": "3.3.0",
"ts-node": "0.5.5",
"tslint": "3.11.0",
"typescript": "1.8.10",
"typings": "1.3.1",
"node":"4.4.0"
}
Looks like Heroku doesn't install your devDependencies
There are two possible variants how to fix it:
Move typings inside dependencies:
"dependencies": {
...
"typings": "^2.1.0",
...
OR
NPM_CONFIG_PRODUCTION needs to be set to false for Heroku to install devDependencies