npm package-lock.json文件-如何清理它?

odopli94  于 2022-12-13  发布在  其他
关注(0)|答案(1)|浏览(311)

I am learning Next.js by following: https://nextjs.org/learn/basics/deploying-nextjs-app/setup
My package.json file looks normal:

{
  "name": "paths",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint"
  },
  "dependencies": {
    "@types/node": "18.11.11",
    "@types/react": "18.0.26",
    "@types/react-dom": "18.0.9",
    "eslint": "8.29.0",
    "eslint-config-next": "13.0.6",
    "next": "13.0.6",
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "typescript": "4.9.3"
  }
}

My package-lock.json file is a 217KB file (5300 lines). The problem is that some of those dependencies/versions exist on another server. When I try to deploy on Vercel, I think it can't find/access those dependencies.
I'm trying to figure out what the best way forward is. It seems like I can:

  1. not create it with package-lock=false and/or
  2. not upload package-lock.json to git.
    Are those my only options?
iyr7buue

iyr7buue1#

如果你认为package-lock.json有什么奇怪的地方,而package.json是正确的,只需删除package-lock.jsonnode_modules,然后用npm i重新创建它们。
如果你得到一个类似的package-lock.json,那么这个文件的内容是准确的。如果你认为它有太多的依赖项,这意味着你的依赖项本身有很多依赖项。Next是出了名的笨重。

相关问题