I am working with a React project and I am going to deploy my app to Vercel, but when I push my code to GitLab I don't want to push package-lock.json
because it will get error with Vercel. Does anyone know the fastest way to push code to GitLab except package-lock.json
using command line?
Asked
Active
Viewed 2,627 times
0

jonrsharpe
- 115,751
- 26
- 228
- 437

Minh Huy
- 51
- 1
- 7
-
4It might be better to ask about fixing the error with Vercel, because without the lockfile your build isn't reproducible and you may end up with other, harder-to-debug problems. – jonrsharpe Sep 28 '21 at 11:09
3 Answers
2
You should add package-lock.json
to your .gitignore
file. If it was previously added and committed to git, you should also remove it from there: git rm --cached package-lock.json
.

Mureinik
- 297,002
- 52
- 306
- 350
1
Either delete the package-lock.json
file and push the code to gitlab beacuse whenever you do the npm i
again, this package-lock.json
will be created again. Like
- rm package-lock.json
- git add .
- git commit -m "your message"
- git push origin your_branch_name
Or you can checkout
the file after git add
like
- git add .
- git checkout
package-lock.json
- git commit -m "your message"
- git push origin your_branch_name
By the way you should try adding the package-lock.json
into .gitignore
file if you don't want to do the same steps again in your future deployments.

Tikam Chand
- 94
- 1
- 10
0
You should try to add a .gitignore file.
-
1As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Sep 28 '21 at 11:31