【问题标题】:npm ERR! Invalid: lock file's ajv@6.12.6 does not satisfy ajv@8.11.0npm 错误!无效:锁定文件的 ajv@6.12.6 不满足 ajv@8.11.0
【发布时间】:2022-10-06 18:32:26
【问题描述】:

我想在 Heroku 中部署我的 React 应用程序,但我的终端中出现此错误:

remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Building on the Heroku-20 stack
remote: -----> Using buildpack: heroku/nodejs
remote: -----> Node.js app detected
remote:        
remote: -----> Creating runtime environment
remote:        
remote:        NPM_CONFIG_LOGLEVEL=error
remote:        NODE_VERBOSE=false
remote:        NODE_ENV=production
remote:        NODE_MODULES_CACHE=true
remote:        
remote: -----> Installing binaries
remote:        engines.node (package.json):  unspecified
remote:        engines.npm (package.json):   unspecified (use default)
remote:        
remote:        Resolving node version 16.x...
remote:        Downloading and installing node 16.17.0...
remote:        Using default npm version: 8.15.0
remote:        
remote: -----> Restoring cache
remote:        Cached directories were not restored due to a change in version of node, npm, yarn or stack
remote:        Module installation may take longer for this build
remote:        
remote: -----> Installing dependencies
remote:        Installing node modules
remote:        npm ERR! code EUSAGE
remote:        npm ERR! 
remote:        npm ERR! `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! Invalid: lock file\'s ajv@6.12.6 does not satisfy ajv@8.11.0
remote:        npm ERR! Missing: ajv@6.12.6 from lock file
remote:        npm ERR! Invalid: lock file\'s @types/react@18.0.17 does not satisfy @types/react@17.0.48
remote:        npm ERR! Invalid: lock file\'s json-schema-traverse@0.4.1 does not satisfy json-schema-traverse@1.0.0
remote:        npm ERR! Missing: ajv@6.12.6 from lock file
  • 你是否错误? `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.
  • 你好,我已经输入了这个命令,但仍然有错误:(

标签: node.js npm


【解决方案1】:
-----> Building on the Heroku-22 stack
-----> Determining which buildpack to use for this app
-----> Node.js app detected
       
-----> Creating runtime environment
       
       NPM_CONFIG_LOGLEVEL=error
       NODE_VERBOSE=false
       NODE_ENV=production
       NODE_MODULES_CACHE=true
       
-----> Installing binaries
       engines.node (package.json):  16.15.0
       engines.npm (package.json):   8.19.1
       
       Resolving node version 16.15.0...
       Downloading and installing node 16.15.0...
       Bootstrapping npm 8.19.1 (replacing 8.5.5)...
       npm 8.19.1 installed
       
-----> Installing dependencies
       Installing node modules
       npm ERR! code EUSAGE
       npm ERR! 
       npm ERR! `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.
       npm ERR! 
       npm ERR! Missing: typescript@4.8.4 from lock file
       npm ERR! 
       npm ERR! Clean install a project
       npm ERR! 
       npm ERR! Usage:
       npm ERR! npm ci
       npm ERR! 
       npm ERR! Options:
       npm ERR! [-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer|--save-bundle]
       npm ERR! [-E|--save-exact] [-g|--global] [--global-style] [--legacy-bundling]
       npm ERR! [--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]]
       npm ERR! [--strict-peer-deps] [--no-package-lock] [--foreground-scripts]
       npm ERR! [--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund] [--dry-run]
       npm ERR! [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
       npm ERR! [-ws|--workspaces] [--include-workspace-root] [--install-links]
       npm ERR! 
       npm ERR! aliases: clean-install, ic, install-clean, isntall-clean
       npm ERR! 
       npm ERR! Run "npm help ci" for more info
       
       npm ERR! A complete log of this run can be found in:
       npm ERR!     /tmp/npmcache.MhMJ4/_logs/2022-10-06T07_41_36_059Z-debug-0.log
-----> Build failed
       
       We're sorry this build is failing! You can troubleshoot common issues here:
       https://devcenter.heroku.com/articles/troubleshooting-node-deploys
       
       If you're stuck, please submit a ticket so we can help:
       https://help.heroku.com/
       
       Love,
       Heroku
       
 !     Push rejected, failed to compile Node.js app.
 !     Push failed

跟你一样

【讨论】:

    【解决方案2】:

    我通过从npm 切换到yarn 解决了我的问题:)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-10-02
      • 2018-08-19
      • 2023-01-19
      • 2020-07-19
      • 1970-01-01
      • 2018-05-17
      • 2018-10-23
      • 2019-07-24
      相关资源
      最近更新 更多