首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何修复‘npm ci`’只能在您的package.json和package-lock.json或npm-收缩包装. sync同步时才能安装包。

如何修复‘npm ci`’只能在您的package.json和package-lock.json或npm-收缩包装. sync同步时才能安装包。
EN

Stack Overflow用户
提问于 2022-08-17 21:32:59
回答 1查看 1.6K关注 0票数 1

我已经在谷歌上找到了几乎所有我能找到的东西,包括npm i,删除package.lock,再次运行npm i,重新克隆项目,更改构建,指定以前的节点版本。

我一直在犯这个错误。我该怎么解决呢?

代码语言:javascript
复制
`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

在我的项目中,我没有看到任何地方列出了这种依赖性。

下面是我的客户机dir中的主package.json文件:

代码语言:javascript
复制
{
  "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文件:

代码语言:javascript
复制
{
  "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"
  }
}

下面是我的项目dir的根目录中的一个package.json:

代码语言:javascript
复制
{
  "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

下面是buildpack输出:

代码语言:javascript
复制
 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

我以前使用过这个buildpack:https://github.com/mars/create-react-app-buildpack.git的创建反应应用程序,但是终端说它已经到了生命的尽头,所以我不得不把它换成:https://github.com/heroku/heroku-buildpack-nodejs

EN

回答 1

Stack Overflow用户

发布于 2022-10-08 17:56:03

我跑到你的问题上时,我正在寻找我的答案无论如何,我只是删除了package.lock文件,并试图重新部署它,它工作了。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/73395138

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档