Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

Two different lockfiles found: package-lock.json and yarn.lock

// if you also encounter this kind of error when using "git push heroku main" then you can try the solution that's works for me
// i use npm and yarn in some of my dependencies so i got this error 
// what i do is to delete my yarn.lock coz i'll be using npm then 
"scripts": {
    "heroku-postbuild": "npm run build:prod"
},
// then this after dependencies
"engines": {
    "node": "^15.14.0",
    "npm": "^7.10.0"
},
  
// 1. change from "yarn run build:prod" to "npm run build:prod"

// 2. delete yarn.lock file

// 3. push changes to git // git commit -m ""

// 4. git push heroku main

//Enumerating objects: 108, done.
//Counting objects: 100% (108/108), done.
//Delta compression using up to 6 threads
//Compressing objects: 100% (100/100), done.
//Writing objects: 100% (108/108), 271.18 KiB | 4.30 MiB/s, done.
//Total 108 (delta 21), 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 
//remote:
//To https://git.heroku.com/
//! [remote rejected] master -> master (pre-receive hook declined)
//error: failed to push some refs to 'https://git.heroku.com/
Comment

Two different lockfiles found: package-lock.json and yarn.lock

# windows
del yarn.lock
# linux
rm yarn.lock
# git add commit push
Comment

PREVIOUS NEXT
Code Example
Javascript :: jquery event keycode 
Javascript :: current date minus days javascript 
Javascript :: nodejs date difference 
Javascript :: check data type in javascript 
Javascript :: js get object keys 
Javascript :: get if user signed in firebase 
Javascript :: react copy to clipboard button 
Javascript :: how to make a deep copy in javascript 
Javascript :: discord.js verify 
Javascript :: nested loops js 
Javascript :: use static pages nodejs 
Javascript :: removeclass multiple 
Javascript :: on mouse not over jquiery 
Javascript :: .call javascript 
Javascript :: javascript difference between two dates in days 
Javascript :: check value exist in array javascript 
Javascript :: copy to clipboard javascript dom 
Javascript :: check if an array is empty javascript 
Javascript :: remove element from array in js 
Javascript :: scroll down div from component angular 
Javascript :: puppeteer get attribute 
Javascript :: next js getserversideprops 
Javascript :: first n even numbers sum javascript 
Javascript :: is check objet empty 
Javascript :: addclass to elementref angular 
Javascript :: js detect link in string 
Javascript :: how to read file extension in a folder in node js 
Javascript :: React Hook "React.useState" is called in function "placeItem" which is neither a React function component or a custom React Hook function react-hooks/rules-of-hooks 
Javascript :: python range in javascript 
Javascript :: alphabet string javascript 
ADD CONTENT
Topic
Content
Source link
Name
5+3 =