我正试图在heroku
上托管我的应用程序,当我使用heroku cli
或github
部署它时它给了我以下错误:
错误
-----> 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: @babel/core@7.18.9 from lock file
npm ERR! Missing: @ampproject/remapping@2.2.0 from lock file
npm ERR! Missing: @babel/generator@7.18.9 from lock file
npm ERR! Missing: @babel/helper-compilation-targets@7.18.9 from lock file
npm ERR! Missing: @babel/helper-module-transforms@7.18.9 from lock file
npm ERR! Missing: @babel/helpers@7.18.9 from lock file
npm ERR! Missing: @babel/parser@7.18.9 from lock file
npm ERR! Missing: @babel/template@7.18.6 from lock file
npm ERR! Missing: @babel/traverse@7.18.9 from lock file
npm ERR! Missing: gensync@1.0.0-beta.2 from lock file
npm ERR! Missing: json5@2.2.1 from lock file
npm ERR! Missing: @jridgewell/gen-mapping@0.1.1 from lock file
npm ERR! Missing: @jridgewell/trace-mapping@0.3.14 from lock file
npm ERR! Missing: @jridgewell/gen-mapping@0.3.2 from lock file
npm ERR! Missing: jsesc@2.5.2 from lock file
npm ERR! Missing: @babel/compat-data@7.18.8 from lock file
npm ERR! Missing: @babel/helper-validator-option@7.18.6 from lock file
npm ERR! Missing: @babel/helper-environment-visitor@7.18.9 from lock file
npm ERR! Missing: @babel/helper-simple-access@7.18.6 from lock file
npm ERR! Missing: @babel/helper-split-export-declaration@7.18.6 from lock file
npm ERR! Missing: @babel/helper-function-name@7.18.9 from lock file
npm ERR! Missing: @babel/helper-hoist-variables@7.18.6 from lock file
npm ERR! Missing: globals@11.12.0 from lock file
npm ERR! Missing: @jridgewell/set-array@1.1.2 from lock file
npm ERR! Missing: @jridgewell/sourcemap-codec@1.4.14 from lock file
npm ERR! Missing: @jridgewell/resolve-uri@3.1.0 from lock file
npm ERR! Missing: typescript@4.7.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! [--no-audit] [--foreground-scripts] [--ignore-scripts]
npm ERR! [--script-shell <script-shell>]
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.wvu98/_logs/2022-07-24T13_15_41_978Z-debug-0.log
-----> Build failed
我尝试删除package-lock.json
,但没有成功。我也尝试过npm ci
,但对我来说也不起作用。我甚至在stack overflow
上搜索,但在云上找不到类似的问题。
npm i
使用package.json并创建package-lock.json,然后npm ci
使用package-lack.json,因此,如果删除packeage-lock.json,则无法运行npm ci
,需要运行npm i
。
如果运行npm i --legacy-peer-deps
必须将npm ci
更改为npm ci --legacy-peer-deps
,因为我的错误是这样的。