React component doesn't show up on Heroku but shows on local - node.js

I am trying to deploy my react app on heroku but only shows index.html without all the components. The app is working fine on localhost. I made a form.js for creating server for nodemailer.
my directory looks like
src
- index.js
form.js
package.json
my package.json
{
"name": "earthly",
"version": "0.1.0",
"private": true,
"proxy": "http://localhost:3001",
"engines": {
"node": "8.11.1",
"npm": "6.2.0"
},
"dependencies": {
"axios": "^0.18.0",
"body-parser": "^1.18.3",
"concurrently": "^3.6.0",
"data.js": "^0.11.5",
"express": "^4.16.3",
"nodemailer": "^4.6.7",
"nodemon": "^1.18.3",
"npm": "^6.2.0",
"react": "^16.4.1",
"react-dom": "^16.4.1",
"react-router-dom": "^4.3.1",
"react-scripts": "1.1.4",
"react-stripe-checkout": "^2.6.3",
"react-stripe-elements": "^2.0.1",
"reactstrap": "^6.3.0"
},
"scripts": {
"start": "concurrently \"cross-env NODE_PATH=src react-
scripts start\" \"node index.js\"",
"server": "nodemon form.js",
"dev": "npm run server",
"build": "react-scripts build",
"test": "cross-env NODE_PATH=src react-scripts test --
env=jsdom",
"eject": "react-scripts eject"
},
"devDependencies": {
"cross-env": "^5.2.0"
},
form.js
app.use(express.static(__dirname + '/public'));
app.get('/', function(req, res) {
res.sendFile('index.html');
});
app.listen(process.env.PORT, '0.0.0.0', function(err) {
console.log("Started listening on %s", app.url);
});
Build log on Heroku
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): 8.11.1
engines.npm (package.json): 6.2.0
Resolving node version 8.11.1...
Downloading and installing node 8.11.1...
Bootstrapping npm 6.2.0 (replacing 5.6.0)...
npm 6.2.0 installed
-----> Restoring cache
Loading 2 from cacheDirectories (default):
- node_modules
- bower_components (not cached - skipping)
-----> Building dependencies
Installing node modules (package.json + package-lock)
audited 21180 packages in 16.791s
found 20 moderate severity vulnerabilities
run `npm audit fix` to fix them, or `npm audit` for
details
-----> Caching build
Clearing previous node cache
Saving 2 cacheDirectories (default):
- node_modules
- bower_components (nothing to cache)
-----> Pruning devDependencies
removed 3 packages and audited 21170 packages in
14.867s
found 20 moderate severity vulnerabilities
run `npm audit fix` to fix them, or `npm audit` for
details
-----> Build succeeded!
-----> Discovering process types
Procfile declares types -> react, web
-----> Compressing...
Done: 62.6M
-----> Launching...
Released v45
https://earthly.herokuapp.com/ deployed to Heroku
I am a student and it is my first time making app with react and heroku so don't know about what to do. If someone can help it would be much appreciated! Thank you.

Related

ERR_INVALID_ARG_TYPE error with prisma during Heroku deployment

first of all, thank you for your help!
I've been trying to deploy my backend app in node.js but everytime I do I'd run into the same issue and I don't know what is that? it was working fine until yesterday
-----> Building on the Heroku-20 stack
-----> Using buildpack: heroku/nodejs
-----> Node.js app detected
-----> Creating runtime environment
NPM_CONFIG_PRODUCTION=true
NPM_CONFIG_LOGLEVEL=error
NODE_VERBOSE=false
NODE_MODULE_CACHE=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 14.x...
Downloading and installing node 14.16.0...
Using default npm version: 6.14.11
-----> Installing dependencies
Installing node modules
> #prisma/client#2.16.1 postinstall /tmp/build_9659a05e/node_modules/#prisma/client
> node scripts/postinstall.js
warning In order to use "#prisma/client", please install Prisma CLI. You can install it with "npm add -D prisma".
> avenidaz-node#1.0.0 postinstall /tmp/build_9659a05e
> npx prisma generate
Prisma schema loaded from prisma/schema.prisma
Error:
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received an instance of Object
at validateString (internal/validators.js:124:11)
at Object.join (path.js:1039:7)
at Object.generateClient (/tmp/build_9659a05e/node_modules/#prisma/client/generator-build/index.js:72910:56)
at async LineStream.<anonymous> (/tmp/build_9659a05e/node_modules/#prisma/client/generator-build/index.js:2802:26)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! avenidaz-node#1.0.0 postinstall: `npx prisma generate`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the avenidaz-node#1.0.0 postinstall 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! /tmp/npmcache.WWuef/_logs/2021-04-06T03_48_25_103Z-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 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
this is my package.json
{
"name": "my aoo",
"version": "1.0.0",
"description": "back end of avenida z",
"main": "src/app.js",
"scripts": {
"postinstall": "npx prisma generate",
"start": "node src/server.js",
"test": "mocha tests/**/*.js --exit"
},
"author": "owner",
"license": "ISC",
"dependencies": {
"#prisma/client": "^2.16.1",
"#sendgrid/mail": "^7.4.1",
"aws-sdk": "^2.768.0",
"bcryptjs": "^2.4.3",
"cors": "^2.8.5",
"dotenv": "^8.2.0",
"express": "^4.17.1",
"express-oauth-server": "^2.0.0",
"heroku-ssl-redirect": "^0.1.1",
"jsonwebtoken": "^8.5.1",
"multer": "^1.4.2",
"papaparse": "^5.3.0",
"pg": "^8.3.2",
"pgtools": "^0.3.0",
"sequelize": "^6.3.4",
"uuid": "^8.3.1",
"winston": "^3.3.3"
},
"devDependencies": {
"#prisma/cli": "^2.15.0",
"mocha": "^8.3.0",
"prisma": "^2.16.1"
}
}
I already try taking out the carat on the prisma dependecies and even removing the prisma from the package.json and ran npm i
I've also tried reset the app by running repo:reset and re-deployed
I tried rolling back the previous commit but i still get the ran error
I noticed that when i run the console in heroku console to check the package.json (cat package.json), the package.json is not updated at all when i tried removing the carats or the prisma from the package.json,

Node app build succeeded but not showing up on Heroku (MEAN Stack app)

I am deploying my app to Heroku, after several failed build attempts it finally succeeded building, but when I want to access the app , it gives me 'Application error'. This is the successful 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): 10.16.3
engines.npm (package.json): 6.11.3
Resolving node version 10.16.3...
Downloading and installing node 10.16.3...
Bootstrapping npm 6.11.3 (replacing 6.9.0)...
npm 6.11.3 installed
-----> Restoring cache
Cached directories were not restored due to a change in version of node, npm, yarn or stack
Module installation may take longer for this build
-----> Installing dependencies
Installing node modules
> fsevents#1.2.11 install /tmp/build_b07ba6f8_/node_modules/fsevents
> node-gyp rebuild
make: Entering directory '/tmp/build_b07ba6f8_/node_modules/fsevents/build'
SOLINK_MODULE(target) Release/obj.target/.node
COPY Release/.node
make: Leaving directory '/tmp/build_b07ba6f8_/node_modules/fsevents/build'
> core-js#2.6.11 postinstall /tmp/build_b07ba6f8_/node_modules/babel-runtime/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"
> core-js#3.2.1 postinstall /tmp/build_b07ba6f8_/node_modules/#angular-devkit/build-
angular/node_modules/core-js
> node scripts/postinstall || echo "ignore"
> bcrypt#3.0.7 install /tmp/build_b07ba6f8_/node_modules/bcrypt
> node-pre-gyp install --fallback-to-build
[bcrypt] Success: "/tmp/build_b07ba6f8_/node_modules/bcrypt/lib/binding/bcrypt_lib.node" is
installed via remote
> #angular/cli#8.3.23 postinstall /tmp/build_b07ba6f8_/node_modules/#angular/cli
> node ./bin/postinstall/script.js
added 1056 packages in 24.037s
-----> Build
-----> Caching build
- node_modules
-----> Pruning devDependencies
removed 496 packages and audited 628 packages in 11.836s
found 132 vulnerabilities (131 low, 1 moderate)
run `npm audit fix` to fix them, or `npm audit` for details
-----> Build succeeded!
-----> Discovering process types
Procfile declares types -> (none)
Default types for buildpack -> web
-----> Compressing...
Done: 54.9M
-----> Launching...
Released v9
Then when I see i cant access my web app, the log says this:
2020-09-29T20:34:29.157236+00:00 app[web.1]: npm ERR! meanstacknieuw#1.0.0 start: node index.js
2020-09-29T20:34:29.157459+00:00 app[web.1]: npm ERR! Exit status 1
2020-09-29T20:34:29.157845+00:00 app[web.1]: npm ERR!
2020-09-29T20:34:29.158095+00:00 app[web.1]: npm ERR! Failed at the meanstacknieuw#1.0.0 start
script.
2020-09-29T20:34:29.158322+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There
is likely additional logging output above.
2020-09-29T20:34:29.170467+00:00 app[web.1]:
2020-09-29T20:34:29.170778+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2020-09-29T20:34:29.171436+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2020-09-29T20_34_29_159Z-
debug.log
2020-09-29T20:34:29.256127+00:00 heroku[web.1]: Process exited with status 1
2020-09-29T20:34:29.304162+00:00 heroku[web.1]: State changed from starting to crashed
This is my package.json file :
` {
"name": "meanstacknieuw",
"version": "1.0.0",
"description": "refreshing",
"main": "index.js",
"engines": {
"node": "10.16.3",
"npm": "6.11.3"
},
"scripts": {
"ng": "ng",
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node index.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/y0u-s/vf-app.git"
},
"keywords": [
"MEAN",
"stack",
"angular",
"2",
"application"
],
"author": "Youssef",
"license": "ISC",
"bugs": {
"url": "https://github.com/y0u-s/latest-mean-stack-app/issues"
},
"homepage": "https://github.com/y0u-s/latest-mean-stack-app#readme",
"dependencies": {
"#angular/cli": "^8.3.20",
"#angular/compiler": "^8.2.14",
"rxjs": "^6.3.3",
"#angular/core": "^7.2.16",
"#angular/compiler-cli": "^8.2.14",
"angular2-flash-messages": "^3.0.1",
"bcrypt": "^3.0.4",
"body-parser": "^1.18.3",
"cors": "^2.8.5",
"express": "^4.16.4",
"file-extension": "^4.0.5",
"jsonwebtoken": "^8.5.1",
"multer": "^1.4.2",
"node-localstorage": "^2.1.4",
"nodemailer": "^6.4.1",
"simple-odata-server": "^1.1.1",
"typescript": "~3.2.2"
},
"devDependencies": {
"#angular-devkit/build-angular": "^0.803.20"
}
}`
my server.js file:
const port = process.env.PORT || 8080;
app.use(function (req, res, next) {
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With,
Content-Type, Accept");
next();
});
app.use(cors({
origin: 'http://localhost:4200'
}));
app.get('*', function(req, res){
res.sendFile(path.join(__dirname + '/public/index.html'));
});
app.listen(port, () => {
console.log('Hello on port ' + port)
});
Please tell me if you need any more context or code.
When heroku starts your app it will run npm run start. Your start script refers to index.js, whereas you are referring to server.js - is this correct?
Does npm run start work properly on localhost?
"scripts": {
"ng": "ng",
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node index.js"
}
In server.js, check for your path is matching with the dist/{folder_name}
{folder_name} can be configure in package.json file.
e.g in the package.json file
{
"name": "folder_name",
}
you need to specify the port of heroku env
app.listen( process.env.PORT || 8001, () => {
console.log("Server listening ...")
})

Heroku Deploy - “Push rejected, failed to compile Node.js app”

Trying to deploy a Laravel+vue application to heroku but when using git push heroku master I get the following trace (only part of the whole trace is shown but it is the part which I believe to be the problem - if not let me know):
remote: npm ERR! code EINTEGRITY
remote: npm ERR! sha512-
Prh/h9CB1jBCBIjSLD6kvIWhMV5S25Bwv7yK0fYJSOTIyg1CmU9OqNdRVCkdWyQY1Hkvm+1YdXJzh3xYupq1KA==
integrity checksum failed when using sha512: wanted sha512-
Prh/h9CB1jBCBIjSLD6kvIWhMV5S25Bwv7yK0fYJSOTIyg1CmU9OqNdRVCkdWyQY1Hkvm+1YdXJzh3xYupq1KA== but
got sha512-
QItiGZBy5TstGy+q8mjQTMGRlDDOARXLxH+sgVm1n/LYeo0zFcQlcCh8m4zi8QxctrxB9Kue/lStc/RD5iLadQ==.
(896052 bytes)
remote:
remote: npm ERR! A complete log of this run can be found in:
remote: npm ERR! /tmp/npmcache.8lpmC/_logs/2020-06-05T11_28_24_085Z-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:
and this my package.json
{
"private": true,
"scripts": {
"dev": "npm run development",
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "npm run development -- --watch",
"watch-poll": "npm run watch -- --watch-poll",
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"prod": "npm run production",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"postinstall": "npm run prod",
"heroku-postbuild": "npm run prod"
},
"devDependencies": {
"axios": "^0.19",
"bootstrap": "^4.0.0",
"cross-env": "^5.1",
"jquery": "^3.5.1",
"laravel-mix": "^5.0.1",
"lodash": "^4.17.13",
"popper.js": "^1.12",
"resolve-url-loader": "^2.3.1",
"sass": "^1.20.1",
"sass-loader": "^8.0.0",
"vue": "^2.5.17",
"vue-template-compiler": "^2.6.10"
},
"dependencies": {
"#fullcalendar/core": "^4.4.0",
"#fullcalendar/daygrid": "^4.4.0",
"#fullcalendar/interaction": "^4.4.0",
"#fullcalendar/vue": "^4.4.0",
"#types/dhtmlxgantt": "^6.0.2",
"admin-lte": "^3.0.2",
"babel-runtime": "^6.26.0",
"bootstrap-vue": "^2.15.0",
"dhtmlx-gantt": "^6.3.7",
"laravel-echo": "^1.7.0",
"laravel-vue-pagination": "^2.3.1",
"mdbvue": "^6.7.0",
"moment": "^2.24.0",
"pusher-js": "^5.1.1",
"sweetalert2": "^9.8.2",
"vform": "^1.0.1",
"vue-full-calendar": "^2.7.0",
"vue-print-nb": "^1.5.0",
"vue-progressbar": "^0.7.5",
"vue-router": "^3.1.6",
"vuex": "^3.1.3"
},
"engines": {
"node": "12.x"
}
}
There's a bunch of error inside and I have no idea why this happen. but after many research i try many ways bu i didn't find the solution .So any help guys i'm stuck here since 2 days
Where you have specified the node version also specify the node version.
see if it works. It worked for me.
"engines": { "node": "12.x", "npm": "your version" }
Specifying the engines object-block helped me with both a Laravel app and a Rails app
package.json (append)
"engines": {
"node": "12.x"
}
Sort-of odd, but when it works, it works.
I also added a #dependabot rebase so that my preview builds using heroku would allow me to verify in-branch that this was the only problem preventing the applications from building.
Check your versions of node and npm in terminal:
node -v
npm -v
and update both in your package.json (example):
"engines": {
"node": "14.x",
"npm": "7.x"
}
just putting node version didn't help me since heroku automatically tried to build another version of npm and crashed
read more here:
https://devcenter.heroku.com/articles/deploying-nodejs#specify-the-version-of-node

npm ERR! missing script: build when deploying react app to heroku

I have a few small react web apps I have made that I am trying to deploy to heroku. I found this https://github.com/mars/create-react-app-buildpack through a youTube video and supposedly this is/was a simple method for deployment. There are several steps the author lists (first two don't apply):
git init
heroku create $APP_NAME --buildpack
https://github.com/mars/create-react-app-buildpack.git
git add .
git commit -m "Start with create-react-app"
git push heroku master
heroku open
Once I get to the git push heroku master I get an error in console that says:
npm ERR! missing script: build
remote:
remote: npm ERR! A complete log of this run can be found in:
remote: npm ERR! /app/.npm/_logs/2018-03-26T16_55_19_748Z-debug.log
remote: ! Push rejected, failed to compile React.js (create-react-app) multi app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to my-simple-react-weather-app.
remote:
To https://git.heroku.com/my-simple-react-weather-app.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/my-simple-react-weather-app.git'
I did some searching and found a few build scripts for my package.json file but none of them seem to work (""build": " webpack --config webpack.conf.js"")
Here is my package.json:
{
"name": "redux-simple-starter",
"version": "1.0.0",
"description": "Simple React YouTube App",
"main": "index.js",
"scripts": {
"start": "node ./node_modules/webpack-dev-server/bin/webpack-dev-server.js",
"test": "mocha --compilers js:babel-core/register --require ./test/test_helper.js --recursive ./test",
"test:watch": "npm run test -- --watch"
},
"author": "",
"license": "ISC",
"devDependencies": {
"babel-core": "^6.2.1",
"babel-loader": "^6.2.0",
"babel-preset-es2015": "^6.1.18",
"babel-preset-react": "^6.1.18",
"chai": "^3.5.0",
"chai-jquery": "^2.0.0",
"jquery": "^2.2.1",
"jsdom": "^8.1.0",
"mocha": "^2.4.5",
"react-addons-test-utils": "^0.14.7",
"webpack": "^1.12.9",
"webpack-dev-server": "^1.14.0"
},
"dependencies": {
"babel-preset-stage-1": "^6.1.18",
"lodash": "^3.10.1",
"react": "^0.14.3",
"react-dom": "^0.14.3",
"react-redux": "4.3.0",
"react-router": "^2.0.1",
"redux": "^3.0.4",
"youtube-api-search": "0.0.5"
}
}
Can anyone help me out here? I am logged into my heroku account already. Is there a simpler way than what I am doing here?
If you provide a git repo it may help to git to the issue quickly but for now make sure you installed
react-scripts
npm i react-scripts --save-dev
make sure -dev is there so it runs before server launch for more details
also, keep your client ( react app ) package.json including the same
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
also its very important to make sure you are using the right buildpacks
if its only react app no node.js for more details
heroku create $APP_NAME --buildpack mars/create-react-app
but if you are building dual with node.js
heroku buildpacks:clear
and consider to follow instructions here How to use create-react-app with a custom Node server on Heroku
You mentioned that "build": " webpack --config webpack.conf.js" is not working. I am guessing that is why you omitted it from your package.json. This is what is needed to resolve the error message. Once you get this script working in your package.json, then all should be good.
Looking at the start script, it's possible that you need to run webpack by specifying it from the .bin directory. I'm not sure what version of node you are using.
scripts: {
...
"build": "./node_modules/.bin/webpack --config webpack.conf.js",
...
}
Try this:
"build": "webpack"
This where I got it from.
https://webpack.js.org/guides/getting-started/

Deploy ng-2 admin Angular 2 to heroku

I'm trying to deploy my project based on ng2-admin .the Build succeeded but whe i launch heroku open to run the project i got :
Application error An error occurred in the application and your page
could not be served. If you are the application owner, check your logs
for details.
Here is the logs:
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_VERBOSE=false
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: engines.yarn (package.json): unspecified (use default)
remote:
remote: Resolving node version 6.x via semver.io...
remote: Downloading and installing node 6.11.0...
remote: Using default npm version: 3.10.10
remote: Resolving yarn version (latest) via semver.io...
remote: Downloading and installing yarn (0.24.5)...
remote: Installed yarn 0.24.5
remote:
remote: -----> Restoring cache
remote: Skipping cache restore (new-signature)
remote:
remote: -----> Building dependencies
remote: Installing node modules (yarn.lock)
remote: yarn install v0.24.5
remote: [1/4] Resolving packages...
remote: [2/4] Fetching packages...
remote: warning fsevents#1.1.1: The platform "linux" is incompatible with this module.
remote: info "fsevents#1.1.1" is an optional dependency and failed compatibility check. Excluding it from installation.
remote: [3/4] Linking dependencies...
remote: warning "angular2-datatable#0.6.0" has incorrect peer dependency "#angular/core#^2.0.0".
remote: warning "angular2-datatable#0.6.0" has incorrect peer dependency "#angular/common#^2.0.0".
remote: warning "angular2-datatable#0.6.0" has incorrect peer dependency "#angular/platform-browser#^2.0.0".
remote: warning "ng2-ckeditor#1.1.6" has incorrect peer dependency "#angular/core#^2.1.0".
remote: warning "ng2-ckeditor#1.1.6" has incorrect peer dependency "#angular/forms#^2.1.0".
remote: warning "ng2-ckeditor#1.1.6" has incorrect peer dependency "#angular/common#^2.1.0".
remote: warning "ng2-handsontable#0.48.0" has incorrect peer dependency "#angular/common#^2.3.1".
remote: warning "ng2-handsontable#0.48.0" has incorrect peer dependency "#angular/compiler#^2.3.1".
remote: warning "ng2-handsontable#0.48.0" has incorrect peer dependency "#angular/core#^2.3.1".
remote: warning "ng2-handsontable#0.48.0" has incorrect peer dependency "#angular/forms#^2.3.1".
remote: [4/4] Building fresh packages...
remote: Done in 47.14s.
remote:
remote: -----> Caching build
remote: Clearing previous node cache
remote: Saving 2 cacheDirectories (default):
remote: - node_modules
remote: - bower_components (nothing to cache)
remote:
remote: -----> Build succeeded!
remote: -----> Discovering process types
remote: Procfile declares types -> (none)
remote: Default types for buildpack -> web
remote:
remote: -----> Compressing...
remote: Done: 60.3M
remote: -----> Launching...
remote: Released v3
remote: https://testngadmin.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy... done.
To https://git.heroku.com/testngadmin.git
My package.json:
{
"name": "ng2-admin",
"version": "1.0.0",
"description": "Angular and Bootstrap 4 Admin Template.",
"author": "Akveo <contact#akveo.com>",
"homepage": "http://akveo.github.io/ng2-admin/",
"repository": {
"type": "git",
"url": "https://github.com/akveo/ng2-admin.git"
},
"bugs": {
"url": "https://github.com/akveo/ng2-admin/issues"
},
"license": "MIT",
"scripts": {
"ng": "ng",
"rimraf": "rimraf",
"changelog": "standard-changelog",
"start": "ng serve",
"start:hmr": "ng serve --hmr",
"start:aot": "ng serve --aot",
"start:prod": "ng serve --prod",
"start:prod:aot": "ng serve --prod --aot",
"build": "npm run clean:dist && ng build",
"build:prod": "npm run build -- --prod",
"build:prod:aot": "npm run build:prod -- --aot",
"build:ci": "npm run build:prod && npm run build:prod:aot",
"build:demo": "npm run build:prod:aot -- --base-href \"http://akveo.com/ng2-admin/\"",
"test": "ng test -sr",
"test:coverage": "npm run clean:coverage && ng test -sr -cc",
"lint": "ng lint",
"lint:styles": "stylelint ./src/app/**/*.scss",
"lint:ci": "npm run lint && npm run lint:styles",
"pree2e": "webdriver-manager update --standalone false --gecko false",
"e2e": "ng e2e",
"clean:dist": "npm run rimraf -- dist",
"clean:coverage": "npm run rimraf -- coverage",
"docs:deploy": "wintersmith build -C docs && gh-pages -d docs/build",
"docs:serve": "wintersmith preview -C docs"
},
"private": true,
"dependencies": {
"#angular/animations": "4.1.3",
"#angular/common": "4.1.3",
"#angular/compiler": "4.1.3",
"#angular/core": "4.1.3",
"#angular/forms": "4.1.3",
"#angular/http": "4.1.3",
"#angular/platform-browser": "4.1.3",
"#angular/platform-browser-dynamic": "4.1.3",
"#angular/platform-server": "4.1.3",
"#angular/router": "4.1.3",
"#ng-bootstrap/ng-bootstrap": "1.0.0-alpha.26",
"#ngx-translate/core": "6.0.1",
"#ngx-translate/http-loader": "0.0.3",
"amcharts3": "3.21.2",
"ammap": "^3.20.7",
"angular2-datatable": "0.6.0",
"animate.css": "3.5.2",
"bootstrap": "4.0.0-alpha.6",
"chart.js": "1.1.1",
"chartist": "0.10.1",
"chroma-js": "1.3.3",
"ckeditor": "4.6.2",
"core-js": "2.4.1",
"easy-pie-chart": "2.1.7",
"font-awesome": "4.7.0",
"fullcalendar": "3.3.1",
"google-maps": "3.2.1",
"ionicons": "2.0.1",
"jquery": "3.2.1",
"jquery-slimscroll": "1.3.8",
"leaflet": "0.7.7",
"leaflet-map": "0.2.1",
"lodash": "4.17.4",
"ng2-ckeditor": "1.1.6",
"ng2-completer": "1.3.1",
"ng2-handsontable": "0.48.0",
"ng2-slim-loading-bar": "4.0.0",
"ng2-smart-table": "1.0.3",
"ng2-tree": "2.0.0-alpha.5",
"ngx-uploader": "2.2.5",
"normalize.css": "6.0.0",
"roboto-fontface": "0.7.0",
"rxjs": "5.4.0",
"zone.js": "0.8.11"
},
"devDependencies": {
"#angular/cli": "1.0.4",
"#angular/compiler-cli": "4.1.3",
"#types/fullcalendar": "2.7.40",
"#types/jasmine": "2.5.38",
"#types/jquery": "2.0.41",
"#types/jquery.slimscroll": "1.3.30",
"#types/lodash": "4.14.61",
"#types/node": "6.0.69",
"codelyzer": "3.0.1",
"gh-pages": "0.12.0",
"jasmine-core": "2.5.2",
"jasmine-spec-reporter": "3.2.0",
"karma": "1.4.1",
"karma-chrome-launcher": "2.0.0",
"karma-cli": "1.0.1",
"karma-coverage-istanbul-reporter": "0.2.0",
"karma-jasmine": "1.1.0",
"karma-jasmine-html-reporter": "0.2.2",
"npm-run-all": "4.0.2",
"protractor": "5.1.0",
"rimraf": "2.6.1",
"standard-changelog": "1.0.1",
"stylelint": "7.10.1",
"ts-node": "2.1.2",
"tslint": "5.2.0",
"tslint-eslint-rules": "4.0.0",
"tslint-language-service": "0.9.6",
"typescript": "2.3.2",
"typogr": "0.6.6",
"underscore": "1.8.3",
"wintersmith": "2.2.5",
"wintersmith-sassy": "1.1.0"
}
}
i solve the problem,
delete /dist from .gitignore
run the project localy in production with npm run build:prod to
generate a /dist folder
modify package.json file by adding
"engines": {
"node": "6.9.1",
"npm": "3.10.8"
}
and
"start": "http-server dist/",
"preinstall": "npm install -g http-server"
in scripts
have you tried adding the following line to the scripts section?
"postinstall": "ng build --aot -prod"
I think that you also need to move:
"#angular/cli": "1.0.4",
"#angular/compiler-cli": "4.1.3",
to the dependencies section for this to work.
Hope it helps.

Resources