I've already followed the instructions on heroku and researched a few hours to find the issue about the deployment to heroku. Whenever I push the repository to heroku, the build fails at building fresh packages.
I am using the yarn package manager and added a lot of dependencies to my app. I added one dependency with NPM and prohibit to choose two package manager for developing . .. I already removed the package-lock.json files and changed the package.json with the scripts to the according package manager I use for my app.
{
"name": "real-world",
"version": "1",
"description": "MERN",
"main": "app.js",
"author": "Le, Vu Minh",
"license": "MIT",
"scripts": {
"client-install": "yarn --cwd frontend install",
"start": "node ./app.js",
"server": "node ./app.js",
"client": "yarn --cwd ./frontend run start",
"dev": "concurrently \"yarn run server\" \"yarn run client\"",
"heroku-postbuild": "yarn install && yarn --cwd ./frontend install && yarn --cwd ./frontend run build"
},
"engines": {
"node": "10.16.0",
"yarn": "1.19.0"
},
"dependencies": {
"body-parser": "^1.19.0",
"concurrently": "^5.0.0",
"cors": "^2.8.5",
"crypto": "^1.0.1",
"dotenv": "^8.2.0",
"errorhandler": "^1.5.1",
"express": "^4.17.1",
"express-jwt": "^5.3.1",
"express-session": "^1.17.0",
"jshint": "^2.10.2",
"jsonwebtoken": "^8.5.1",
"jwt": "^0.2.0",
"method-override": "^3.0.0",
"mongoose": "^5.7.4",
"morgan": "^1.9.1",
"passport": "^0.4.0",
"passport-local": "^1.0.0",
"serve": "^11.2.0"
},
"devDependencies": {
"nodemon": "^1.19.3"
}
}
That is the output, when I push to the heroku master branch.
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.16.0
remote: engines.npm (package.json): unspecified (use default)
remote: engines.yarn (package.json): 1.19.0
remote:
remote: Resolving node version 10.16.0...
remote: Downloading and installing node 10.16.0...
remote: Using default npm version: 6.9.0
remote: Resolving yarn version 1.19.0...
remote: Downloading and installing yarn (1.19.0)...
remote: Installed yarn 1.19.0
remote:
remote: -----> Installing dependencies
remote: Installing node modules (yarn.lock)
remote: yarn install v1.19.0
remote: [1/4] Resolving packages...
remote: [2/4] Fetching packages...
remote: info fsevents@1.2.9: The platform "linux" is incompatible with this module.
remote: info "fsevents@1.2.9" is an optional dependency and failed compatibility check. Excluding it from installation.
remote: [3/4] Linking dependencies...
remote: [4/4] Building fresh packages...
remote: error /tmp/build_8fb6cb960e5fba9ed79ab935cf0403ce/node_modules/node-base64: Command failed.
remote: Exit code: 127
remote: Command: ./install.sh
remote: Arguments:
remote: Directory: /tmp/build_8fb6cb960e5fba9ed79ab935cf0403ce/node_modules/node-base64
remote: Output:
remote: ./install.sh: 3: ./install.sh: node-waf: not found
remote: info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.