heroku 如何修复当package.json和package-lock.json或npm-shrinkwrap.json同步时,'npm ci'只能安装软件包

ep6jt1vc  于 2022-11-13  发布在  其他
关注(0)|答案(1)|浏览(100)

我已经尝试了几乎所有我能在google上找到的东西,包括npm i,删除package.lock并再次运行npm i,重新克隆项目,更改构建,指定以前的节点版本。
我不断收到此错误。如何解决?

`npm ci` can only install packages when your package.json and package-lock.json or npm-shrinkwrap.json are in sync. Please update your lock file with `npm install` before continuing.
remote:        npm ERR! 
remote:        npm ERR! Missing: typescript@4.7.4 from lock file

我在项目中任何地方都没有看到列出的依赖项。
下面是我的客户端目录中的主package.json文件:

{
  "name": "hello",
  "version": "0.1.0",
  "engines": {
    "node": "16.x",
    "npm": "8.x"
  },
  "private": true,
  "dependencies": {
    "@chakra-ui/icons": "^1.1.1",
    "@chakra-ui/react": "^1.8.1",
    "@chec/commerce.js": "^2.8.0",
    "@emotion/react": "^11.7.1",
    "@emotion/styled": "^11.6.0",
    "@inlightmedia/react-countdown-timer": "^1.1.2",
    "@nilevia/count-down-timer-react": "^1.0.4",
    "@paypal/react-paypal-js": "^7.6.0",
    "@react-firebase/database": "^0.3.11",
    "@stripe/react-stripe-js": "^1.7.2",
    "@stripe/stripe-js": "^1.29.0",
    "@testing-library/jest-dom": "^5.16.1",
    "@testing-library/react": "^12.1.2",
    "@testing-library/user-event": "^13.5.0",
    "add2calendar": "^1.1.7",
    "axios": "^0.25.0",
    "ethers": "^5.5.4",
    "firebase": "^9.7.0",
    "formik": "^2.2.9",
    "framer-motion": "^5.6.0",
    "hamburger-react": "^2.4.1",
    "moralis": "^1.3.1",
    "ngrok": "^4.3.1",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "react-google-places-autocomplete": "^3.4.0",
    "react-icons": "^4.3.1",
    "react-moralis": "^1.3.1",
    "react-open-app": "^1.0.3",
    "react-responsive-carousel": "^3.2.23",
    "react-router-dom": "^6.2.1",
    "react-scripts": "5.0.0",
    "react-slick": "^0.28.1",
    "react-timer-hook": "^3.0.5",
    "react-toastify": "^8.2.0",
    "stripe": "^8.194.0",
    "use-react-countdown": "^1.0.4",
    "web-vitals": "^2.1.4"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject",
    "ngrok": "ngrok"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}

下面是我的ethers目录中的一个package.json文件:

{
  "name": "smart_constracts",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "harleauxcarrera",
  "license": "ISC",
  "devDependencies": {
    "@nomiclabs/hardhat-ethers": "^2.0.4",
    "@nomiclabs/hardhat-waffle": "^2.0.2",
    "chai": "^4.3.6",
    "ethereum-waffle": "^3.4.0",
    "ethers": "^5.5.4",
    "hardhat": "^2.8.3"
  }
}

下面是一个package.json,位于我的项目目录的根目录下:

{
  "dependencies": {
    "@chakra-ui/react": "^1.8.1",
    "@chec/commerce.js": "^2.8.0",
    "@emotion/react": "^11.7.1",
    "@emotion/styled": "^11.6.0",
    "@openzeppelin/contracts": "^4.4.2",
    "framer-motion": "^5.6.0",
    "react-dom": "^17.0.2",
    "react-helmet": "^6.1.0",
    "react-open-app": "^1.0.3",
    "react-scripts": "^5.0.0",
    "use-react-countdown": "^1.0.4"
  },
  "scripts": {
    "start": "npm start --prefix client"
  }
}

以下是我正在使用的构建包:

  1. https://github.com/timanovsky/subdir-heroku-buildpack
  2. https://github.com/heroku/heroku-buildpack-nodejs
    下面是构建包的输出:
Building on the Heroku-20 stack
remote: -----> Using buildpacks:
remote:        1. https://github.com/timanovsky/subdir-heroku-buildpack
remote:        2. https://github.com/heroku/heroku-buildpack-nodejs
remote: -----> Subdir buildpack app detected
remote: -----> Subdir buildpack in client
remote:        creating cache: /tmp/codon/tmp/cache
remote:        created tmp dir: /tmp/codon/tmp/cache/subdirXYvgi
remote:        moving working dir: client to /tmp/codon/tmp/cache/subdirXYvgi
remote:        cleaning build dir /tmp/build_155f5cac
remote:        copying preserved work dir from cache /tmp/codon/tmp/cache/subdirXYvgi to build dir /tmp/build_155f5cac
remote:        cleaning tmp dir /tmp/codon/tmp/cache/subdirXYvgi
remote: -----> Node.js app detected
remote:        
remote: -----> Creating runtime environment
remote:        
remote:        NPM_CONFIG_PRODUCTION=false
remote:        NPM_CONFIG_LOGLEVEL=error
remote:        NODE_VERBOSE=false
remote:        NODE_ENV=production
remote:        NODE_MODULES_CACHE=true

我以前使用过此构建包:https://github.com/mars/create-react-app-buildpack.git用于create-react-app,但终端显示其已达到使用寿命,因此我不得不将其切换为:https://github.com/heroku/heroku-buildpack-nodejs

z9zf31ra

z9zf31ra1#

我运行到您的问题时,我正在搜索我的答案无论如何,我只是删除了package.lock文件,并试图再次部署它,它的工作

相关问题