heroku : Conflict: Multiple assets emit different content to the same filename - node.js

I don't know much about vue front end but I am hosting it on Heroku it looks easy in documentation and videos but I keep getting this error no matter what I do.
When I push my code on Heroku it gives me this error.
Enumerating objects: 95, done.
Counting objects: 100% (95/95), done.
Delta compression using up to 8 threads
Compressing objects: 100% (91/91), done.
Writing objects: 100% (95/95), 922.85 KiB | 5.49 MiB/s, done.
Total 95 (delta 23), reused 0 (delta 0), 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): 16.16.0
remote: engines.npm (package.json): unspecified (use default)
remote:
remote: Resolving node version 16.16.0...
remote: Downloading and installing node 16.16.0...
remote: Using default npm version: 8.11.0
remote:
remote: -----> Installing dependencies
remote: Installing node modules
remote:
remote: > cashflow#0.1.0 postinstall
remote: > npm run build
remote:
remote:
remote: > cashflow#0.1.0 build
remote: > vue-cli-service build
remote:
remote: All browser targets in the browserslist configuration have supported ES module.
remote: Therefore we don't build two separate bundles for differential loading.
remote:
remote:
remote: - Building for production...
remote: ERROR Failed to compile with 10 errors6:33:06 AM
remote:
remote: error
remote:
remote: Conflict: Multiple assets emit different content to the same filename js/signup.04385344.js.map
remote:
remote: error
remote:
remote: Conflict: Multiple assets emit different content to the same filename js/login.8bbc6e49.js.map
remote:
remote: error
remote:
remote: Conflict: Multiple assets emit different content to the same filename js/dashboard.cb36601d.js.map
remote:
remote: error
remote:
remote: Conflict: Multiple assets emit different content to the same filename js/119.cc0d4e84.js.map
remote:
remote: error
remote:
remote: Conflict: Multiple assets emit different content to the same filename js/206.076964cc.js.map
remote:
remote: error
remote:
remote: Conflict: Multiple assets emit different content to the same filename js/chunk-vendors.c45faf35.js.map
remote:
remote: error
remote:
remote: Conflict: Multiple assets emit different content to the same filename js/218.16810e2b.js.map
remote:
remote: error
remote:
remote: Conflict: Multiple assets emit different content to the same filename js/862.c30a7c87.js.map
remote:
remote: error
remote:
remote: Conflict: Multiple assets emit different content to the same filename js/489.c2352728.js.map
remote:
remote: error
remote:
remote: Conflict: Multiple assets emit different content to the same filename js/939.3bc5670c.js.map
remote:
remote: ERROR Error: Build failed with errors.
remote: Error: Build failed with errors.
remote: at /tmp/build_db7c88fd/node_modules/#vue/cli-service/lib/commands/build/index.js:207:23
remote: at /tmp/build_db7c88fd/node_modules/webpack/lib/webpack.js:148:8
remote: at /tmp/build_db7c88fd/node_modules/webpack/lib/HookWebpackError.js:68:3
remote: at Hook.eval [as callAsync] (eval at create (/tmp/build_db7c88fd/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
remote: at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/tmp/build_db7c88fd/node_modules/tapable/lib/Hook.js:18:14)
remote: at Cache.shutdown (/tmp/build_db7c88fd/node_modules/webpack/lib/Cache.js:150:23)
remote: at /tmp/build_db7c88fd/node_modules/webpack/lib/Compiler.js:1225:15
remote: at Hook.eval [as callAsync] (eval at create (/tmp/build_db7c88fd/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
remote: at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/tmp/build_db7c88fd/node_modules/tapable/lib/Hook.js:18:14)
remote: at Compiler.close (/tmp/build_db7c88fd/node_modules/webpack/lib/Compiler.js:1218:23)
remote: npm ERR! code 1
remote: npm ERR! path /tmp/build_db7c88fd
remote: npm ERR! command failed
remote: npm ERR! command sh -c npm run build
remote:
remote: npm ERR! A complete log of this run can be found in:
remote: npm ERR! /tmp/npmcache.mj21d/_logs/2022-08-06T06_32_22_878Z-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: 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 crunch-reporting.
remote:
To https://git.heroku.com/crunch-reporting.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/crunch-reporting.git'
I tried a lot of things like defining node version.
I tried using buildpacks on heroku.
I tried changing server.js file .
NO luck
server.js
const express = require('express');
const serveStatic = require("serve-static")
const path = require('path');
app = express();
app.use(serveStatic(path.join(__dirname, 'dist')));
const port = process.env.PORT || 80;
app.listen(port);
console.log("Listening on port : " + port)
package.js
{
"name": "cashflow",
"version": "0.1.0",
"private": true,
"engines": {
"node": "16.16.0"
},
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"postinstall": "npm run build",
"start": "node server.js"
},
"dependencies": {
"axios": "^0.27.2",
"core-js": "^3.8.3",
"vue": "^2.6.14",
"vue-router": "^3.5.1",
"vuetify": "^2.6.0",
"vuex": "^3.6.2"
},
"devDependencies": {
"#vue/cli-plugin-babel": "~5.0.0",
"#vue/cli-plugin-router": "~5.0.0",
"#vue/cli-plugin-vuex": "~5.0.0",
"#vue/cli-service": "~5.0.0",
"express": "^4.18.1",
"sass": "~1.32.0",
"sass-loader": "^10.0.0",
"serve-static": "^1.15.0",
"vue-cli-plugin-vuetify": "~2.5.1",
"vue-template-compiler": "^2.6.14",
"vuetify-loader": "^1.7.0"
},
"browserslist": [
"> 1%",
"last 2 versions",
"not dead"
]
}

Related

"- Node version not specified in package.json" while hosting on heroku

I have a MERN project that I want to host on Heroku, but while deploying it I'm getting an error:- "Push rejected, failed to compile Node.js app. Push failed". below is the package.json file of the server/backend :-
{
"name": "backend",
"version": "1.0.0",
"description": "Blog-Application",
"main": "app.js",
"type": "module",
"scripts": {
"start": "node app.js",
"heroku-postbuild" : "NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client"
},
"author": "",
"license": "ISC",
"dependencies": {
"alert": "^5.0.10",
"bcryptjs": "^2.4.3",
"cors": "^2.8.5",
"express": "^4.18.1",
"mongoose": "^6.3.2",
"nodemon": "^2.0.16",
"popups": "^1.1.3"
}
}
I checked package.json but didn't find any mistake(Taking reference to some videos)...but when I'm running this command:-
git push heroku master
this is showing me:-
Enumerating objects: 61, done.
Counting objects: 100% (61/61), done.
Delta compression using up to 4 threads
Compressing objects: 100% (59/59), done.
Writing objects: 100% (61/61), 1.25 MiB | 235.00 KiB/s, done.
Total 61 (delta 1), reused 0 (delta 0), 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): unspecified
remote: engines.npm (package.json): unspecified (use default)
remote:
remote: Resolving node version 16.x...
remote: Downloading and installing node 16.15.1...
remote: Using default npm version: 8.11.0
remote:
remote: -----> Installing dependencies
remote: Installing node modules
remote:
remote: added 211 packages, and audited 212 packages in 4s
remote:
remote: 29 packages are looking for funding
remote: run `npm fund` for details
remote:
remote: found 0 vulnerabilities
remote:
remote: -----> Build
remote: Running heroku-postbuild
remote:
remote: > backend#1.0.0 heroku-postbuild
remote: > NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client
remote:
remote: npm ERR! code ENOENT
remote: npm ERR! syscall open
remote: npm ERR! path /tmp/build_cf8c0d20/client/package.json
remote: npm ERR! errno -2
remote: npm ERR! enoent ENOENT: no such file or directory, open '/tmp/build_cf8c0d20/client/package.json'
remote: npm ERR! enoent This is related to npm not being able to find a file.
remote: npm ERR! enoent
remote:
remote: npm ERR! A complete log of this run can be found in:
remote: npm ERR! /tmp/npmcache.aw0ai/_logs/2022-06-13T18_00_08_638Z-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: Verifying deploy...
remote:
remote: ! Push rejected to blogsite07.
remote:
To https://git.heroku.com/blogsite07.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/blogsite07.git'
Please help me, where I'm doing wrong.

Unable to push to Heroku: Cannot find module 'node-linux-x64/package.json'

I'm really stuck and would really appreciate some help. This question was asked previously here Error while pushing to Heroku: Cannot find module 'node-linux-x64/package.json' however, despite trying all the suggestions I was still unable to resolve this problem.
Just like the individual before who posted the problem initially, I am trying to push a full stack Javascript app to Heroku.
I've re-installed all my dependencies and even downgraded my node and npm.
This issue is especially confusing as I am a Windows user, so to be receiving an error about a module regarding linux feels quite strange.
Please help.
C:\Users\Greg\Desktop\GregBots\reactbot> git push heroku master
Enumerating objects: 41, done.
Counting objects: 100% (41/41), done.
Delta compression using up to 8 threads
Compressing objects: 100% (28/28), done.
Writing objects: 100% (28/28), 19.45 KiB | 1.95 MiB/s, done.
Total 28 (delta 15), 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): 13.6.0
remote: engines.npm (package.json): 6.13.4
remote:
remote: Resolving node version 13.6.0...
remote: Downloading and installing node 13.6.0...
remote: npm 6.13.4 already installed with node
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 (package.json + package-lock)
remote:
remote: > node#13.8.0 preinstall /tmp/build_5798122e415d759253929a4b5b0a6c16/node_modules/node
remote: > node installArchSpecificPackage
remote:
remote: npm ERR! code ETARGET
remote: npm ERR! notarget No matching version found for node-linux-x64#13.8.0.
remote: npm ERR! notarget In most cases you or one of your dependencies are requesting
remote: npm ERR! notarget a package version that doesn't exist.
remote:
remote: npm ERR! A complete log of this run can be found in:
remote: npm ERR! /tmp/npmcache.3VsTs/_logs/2020-02-26T01_02_25_357Z-debug.log
remote: internal/modules/cjs/loader.js:976
remote: throw err;
remote: ^
remote:
remote: Error: Cannot find module 'node-linux-x64/package.json'
remote: Require stack:
remote: - /tmp/build_5798122e415d759253929a4b5b0a6c16/node_modules/node/installArchSpecificPackage.js
remote: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:973:15)
remote: at Function.resolve (internal/modules/cjs/helpers.js:78:19)
remote: at ChildProcess.<anonymous> (/tmp/build_5798122e415d759253929a4b5b0a6c16/node_modules/node-bin-setup/index.js:18:27)
remote: at ChildProcess.emit (events.js:321:20)
remote: at maybeClose (internal/child_process.js:1028:16)
remote: at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5) {
remote: code: 'MODULE_NOT_FOUND',
remote: requireStack: [
remote: '/tmp/build_5798122e415d759253929a4b5b0a6c16/node_modules/node/installArchSpecificPackage.js'
remote: ]
remote: }
remote: npm ERR! code ELIFECYCLE
remote: npm ERR! errno 1
remote: npm ERR! node#13.8.0 preinstall: `node installArchSpecificPackage`
remote: npm ERR! Exit status 1
remote: npm ERR!
remote: npm ERR! Failed at the node#13.8.0 preinstall 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.3VsTs/_logs/2020-02-26T01_02_26_775Z-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: - A module may be missing from 'dependencies' in package.json
remote: https://devcenter.heroku.com/articles/troubleshooting-node-deploys#ensure-you-aren-t-relying-on-untracked-dependencies
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 infinite-sea-94371.
remote:
To https://git.heroku.com/infinite-sea-94371.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/infinite-sea-94371.git'
PS C:\Users\Greg\Desktop\GregBots\reactbot>
Thanks a bunch for your suggestions Mazen. I've went through your advice, but can't deploy to Heroku still. I've now attached my package.json which I am pushing as well to Heroku as Heroku installs the dependencies that are needed as per the package.
{
"name": "reactbot",
"version": "1.0.0",
"description": "React bot",
"main": "index.js",
"engines": {
"node": "13.6.0",
"npm": "6.13.4"
},
"scripts": {
"start": "node index.js",
"backend": "nodemon index.js",
"frontend": "npm run start --prefix client",
"dev": "concurrently \"npm run backend\" \"npm run frontend\"",
"heroku-postbuild": "NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client"
},
"author": "",
"license": "ISC",
"dependencies": {
"actions-on-google": "^2.12.0",
"body-parser": "^1.19.0",
"dialogflow": "^1.2.0",
"dialogflow-fulfillment": "^0.6.1",
"express": "^4.17.1",
"mongoose": "^5.9.2"
},
"devDependencies": {
"concurrently": "^5.1.0",
"nodemon": "^2.0.2"
}
}
This error might be caused by multiple things:
According to your error, the npm package node-linux-x64 is set to the wrong version that doesn't exist. Remove node-linux-x64 as Heroku installs the most updated version of Node.js for their system or set it to an existing version.
Did you push your package.json file with your code?
You have pushed your node_module to Heroku which has certain versions of some packages that can only work on your distribution/OS.
You might have installed an npm package globally and forgot to include it to your packages.json file.

I'm getting this error when I 'git push heroku master' for my discord.js bot

So I have a discord bot written in js and I wanted to host it using Heroku because you get 1000 hours of hosting per month for free. I read some guides and stuff, but no matter what I did I get this error when I push on Heroku with git push heroku master. (I have Procfile configured):
error
Enumerating objects: 62, done.
Counting objects: 100% (62/62), done.
Delta compression using up to 4 threads
Compressing objects: 100% (54/54), done.
Writing objects: 100% (62/62), 8.80 KiB | 1.76 MiB/s, done.
Total 62 (delta 18), 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.x
remote: engines.npm (package.json): unspecified (use default)
remote:
remote: Resolving node version 10.x...
remote: Downloading and installing node 10.19.0...
remote: Using default npm version: 6.13.4
remote:
remote: -----> Installing dependencies
remote: Installing node modules (package.json + package-lock)
remote:
remote: > node#13.8.0 preinstall /tmp/build_bb6a303ef77491603b3088575e05b576/node_modules/node
remote: > node installArchSpecificPackage
remote:
remote: npm ERR! code ETARGET
remote: npm ERR! notarget No matching version found for node-linux-x64#13.8.0.
remote: npm ERR! notarget In most cases you or one of your dependencies are requesting
remote: npm ERR! notarget a package version that doesn't exist.
remote:
remote: npm ERR! A complete log of this run can be found in:
remote: npm ERR! /tmp/npmcache.HDmIW/_logs/2020-02-24T17_35_08_149Z-debug.log
remote: internal/modules/cjs/loader.js:638
remote: throw err;
remote: ^
remote:
remote: Error: Cannot find module 'node-linux-x64/package.json'
remote: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
remote: at Function.resolve (internal/modules/cjs/helpers.js:33:19)
remote: at ChildProcess.<anonymous> (/tmp/build_bb6a303ef77491603b3088575e05b576/node_modules/node-bin-setup/index.js:18:27)
remote: at ChildProcess.emit (events.js:198:13)
remote: at maybeClose (internal/child_process.js:982:16)
remote: at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
remote: npm ERR! code ELIFECYCLE
remote: npm ERR! errno 1
remote: npm ERR! node#13.8.0 preinstall: `node installArchSpecificPackage`
remote: npm ERR! Exit status 1
remote: npm ERR!
remote: npm ERR! Failed at the node#13.8.0 preinstall 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.HDmIW/_logs/2020-02-24T17_35_08_183Z-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: - A module may be missing from 'dependencies' in package.json
remote: https://devcenter.heroku.com/articles/troubleshooting-node-deploys#ensure-you-aren-t-relying-on-untracked-dependencies
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 b-r-u-h-discord-bot.
remote:
To https://git.heroku.com/b-r-u-h-discord-bot.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/b-r-u-h-discord-bot.git'
package.json
{
"name": "bruh-bot",
"version": "0.0.1",
"description": "This is B R U H bot ",
"main": "index.js",
"scripts": {
"test": "!test",
"start": "node index.js"
},
"author": "da_dev",
"license": "ISC",
"dependencies": {
"#discordjs/uws": "^10.149.0",
"discord.js": "^11.5.1"
},
"engines": {
"node": "10.x"
},
"devDependencies": {},
"repository": {
"type": "git",
"url": "git+https://github.com/da-the-dev/b-r-u-h.git"
},
"bugs": {
"url": "https://github.com/da-the-dev/b-r-u-h/issues"
},
"homepage": "https://github.com/da-the-dev/b-r-u-h#readme"
}
I spent an entire day surfing the web with no success. Maybe someone has an idea of how to deal with this issue?

Failed to push some refs in Heroku

`I tried to push my web application to Heroku but it gave me this error. I searched for similar problems but it didn't help me. I did this before and it worked but when I tried to do it again it failed and I don't know why.
How can I resolve this error?
PS D:\react application> git push heroku master
Enumerating objects: 125, done.
Counting objects: 100% (125/125), done.
Delta compression using up to 4 threads
Compressing objects: 100% (116/116), done.
Writing objects: 100% (125/125), 2.56 MiB | 31.00 KiB/s, done.
Total 125 (delta 29), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Node.js app detected
remote:
remote: -----> Build failed
remote: ! Two different lockfiles found: package-lock.json and yarn.lock
remote:
remote: Both npm and yarn have created lockfiles for this application,
remote: but only one can be used to install dependencies. Installing
remote: dependencies using the wrong package manager can result in missing
remote: packages or subtle bugs in production.
remote:
remote: - To use npm to install your application's dependencies please delete
remote: the yarn.lock file.
remote:
remote: $ git rm yarn.lock
remote:
remote: - To use yarn to install your application's dependences please delete
remote: the package-lock.json file.
remote:
remote: $ git rm package-lock.json
remote:
remote: https://kb.heroku.com/why-is-my-node-js-build-failing-because-of-conflicting-lock-files
remote:
remote: ! Push rejected, failed to compile Node.js app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to heroku-react-app-3.
remote:
To https://git.heroku.com/heroku-react-app-3.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/heroku-react-app-3.git'
Here's my application code:
const path = require('path');
const express = require('express');
const app = express();
const publicPath = path.join(__dirname, '..','public');
const port = process.env.PORT || 3000;
app.use(express.static(publicPath));
app.get('*', (req,res) => {
res.sendFile(path.join(publicPath,'index.html'))
});
app.listen(port, () => {
console.log('Server is up');
});
after deleting yarn.lock
PS D:\react application> git push heroku master
Enumerating objects: 130, done.
Counting objects: 100% (130/130), done.
Delta compression using up to 4 threads
Compressing objects: 100% (121/121), done.
Writing objects: 100% (130/130), 2.56 MiB | 33.00 KiB/s, done.
Total 130 (delta 32), 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.16.0
remote: engines.npm (package.json): unspecified (use default)
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:
remote: -----> Installing dependencies
remote: Installing node modules (package.json + package-lock)
remote:
remote: > node-sass#4.12.0 install /tmp/build_fa4b97b82e26e28c8efaef8a02fd356e/node_modules/node-sass
remote: > node scripts/install.js
remote:
remote: Downloading binary from https://github.com/sass/node-sass/releases/download/v4.12.0/linux-x64-64_binding.node
remote: Download complete
remote: Binary saved to /tmp/build_fa4b97b82e26e28c8efaef8a02fd356e/node_modules/node-sass/vendor/linux-x64-64/binding.node
remote: Caching binary to /tmp/npmcache.jQpTT/node-sass/4.12.0/linux-x64-64_binding.node
remote:
remote: > core-js#2.6.9 postinstall /tmp/build_fa4b97b82e26e28c8efaef8a02fd356e/node_modules/core-js
remote: > node scripts/postinstall || echo "ignore"
remote:
remote:
remote: > uglifyjs-webpack-plugin#0.4.6 postinstall /tmp/build_fa4b97b82e26e28c8efaef8a02fd356e/node_modules/uglifyjs-webpack-plugin
remote: > node lib/post_install.js
remote:
remote:
remote: > node-sass#4.12.0 postinstall /tmp/build_fa4b97b82e26e28c8efaef8a02fd356e/node_modules/node-sass
remote: > node scripts/build.js
remote:
remote: Binary found at /tmp/build_fa4b97b82e26e28c8efaef8a02fd356e/node_modules/node-sass/vendor/linux-x64-64/binding.node
remote: Testing binary
remote: Binary is fine
remote: added 1139 packages from 774 contributors and audited 16655 packages in 26.036s
remote: found 36 vulnerabilities (31 low, 2 moderate, 3 high)
remote: run `npm audit fix` to fix them, or `npm audit` for details
remote:
remote: -----> Build
remote: Detected both "build" and "heroku-postbuild" scripts
remote: Running heroku-postbuild
remote:
remote: > expensify#1.0.0 heroku-postbuild /tmp/build_fa4b97b82e26e28c8efaef8a02fd356e
remote: > yarn run build:prod
remote:
remote: sh: 1: yarn: not found
remote: npm ERR! file sh
remote: npm ERR! code ELIFECYCLE
remote: npm ERR! errno ENOENT
remote: npm ERR! syscall spawn
remote: npm ERR! expensify#1.0.0 heroku-postbuild: `yarn run build:prod`
remote: npm ERR! spawn ENOENT
remote: npm ERR!
remote: npm ERR! Failed at the expensify#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.jQpTT/_logs/2019-06-11T22_03_49_679Z-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 heroku-react-app-3.
remote:
To https://git.heroku.com/heroku-react-app-3.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/heroku-react-app-3.git'
my scripts
"engines": {
"node":"10.16.0"
},
"scripts": {
"serve": "live-server public/",
"build": "webpack",
"build:dev": "webpack",
"build:prod": "webpack -p --env production",
"dev-server": "webpack-dev-server",
"test": "jest --config=jest.config.json",
"start": "node server/server.js",
"heroku-postbuild": "yarn run build:prod"
}
As given the problem is that you are having both package-lock.json and yarn.lock
The heroku uses other servers to deploy your app hence it needs to download the dependencies on that remote server.
As you have two dependencies files so heroku can not decide which one to use to download dependencies hence the error.
Delete the one that you are not using(generally yarn.json) and your app will be good to go.

Node.js app building error "UNMET DEPENDENCY phantomjs-prebuilt#^2.1.4" on Heroku platform

Project is cloned from existing repository and not yet modified:
https://github.com/ebdrup/html2pdf.it
I am looking for piece of information that would help me get through this simple looking yet frustrating warning/error. App cannot successfully run without phantomjs-prebuilt dependency and I am unskilled in Node.js and its project structures.
I have been researching and trying for almost 5 days now. I can manage to run the project locally through Node.js console easily.
The problem seems to be in telling the Heroku where to find the phantomjs-prebuilt file.
I have tried installing the dependency locally in the project directory with:
npm install
I have tried moving phantomjs binary manually into the bin/
I can run phantomjs on Heroku using:
heroku run phantomjs
CMD Output after building on Heroku:
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): 0.10.x
remote: engines.npm (package.json): unspecified (use default)
remote:
remote: Resolving node version 0.10.x via semver.io...
remote: Downloading and installing node 0.10.48...
remote: Using default npm version: 2.15.1
remote:
remote: -----> Restoring cache
remote: Loading 2 from cacheDirectories (default):
remote: - node_modules
remote: - bower_components (not cached - skipping)
remote:
remote: -----> Building dependencies
remote: Installing node modules (package.json + shrinkwrap)
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: ├── compression#1.4.0
remote: ├── express#4.11.2
remote: ├── morgan#1.5.1
remote: ├── node-uuid#1.4.2
remote: ├── UNMET DEPENDENCY phantomjs-prebuilt#^2.1.4
remote: ├── request#2.53.0
remote: └── slugify-url#1.2.0
remote:
remote: ! Unmet dependencies don't fail npm install but may cause runtime issues
remote: https://github.com/npm/npm/issues/7494
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> (none)
remote: Default types for buildpack -> web
remote:
remote: -----> Compressing...
remote: Done: 32.9M
remote: -----> Launching...
remote: Released v5
remote: https://h2ptest.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy... done.
To https://git.heroku.com/h2ptest.git
b278f4b..bce77f9 master -> master
package.json:
"engines": {
"node": "0.10.x"
},
"main": "./lib/app.js",
"dependencies": {
"compression": "^1.1.0",
"express": "",
"morgan": "^1.3.1",
"node-uuid": "",
"phantomjs-prebuilt": "^2.1.14",
"request": "",
"slugify-url": ""
},
"devDependencies": {
"mocha": "",
"chai": "",
"sinon": "",
"sinon-chai": "",
"underscore": "",
"mocha-jshint": "",
"open": ""
},
"scripts": {
"start": "node ./lib/app.js",
"test": "_mocha"
},
"directories": {
"test": "test"
},

Resources