尝试在Heroku上部署项目时出现节点模块错误



不太确定这里的问题是什么。我已经在package.json中更改了我的节点版本,在删除我的package-lock.json后,我也重新安装了npm。其他人遇到过这个问题吗?我该如何解决这个问题?

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! Invalid: lock file's type-fest@0.21.3 does not satisfy type-fest@0.13.1
npm ERR! Missing: type-fest@0.21.3 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.EX2Wa/_logs/2022-07-15T17_34_47_694Z-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```

当您使用NPM安装模块时,它会创建两个东西:

  • CCD_ 1文件
  • node_modules文件夹

第一个包含应用程序所需的所有依赖项的名称和版本,第二个包含package-lock.json文件中指定的实际模块和依赖项。

在将应用程序推入Heroku之前,请删除package-lock.json(NOTpackage.json)文件。

然后,通过npm install命令重新安装模块。

它将生成最新的package-lock.json。然后,推送你的应用程序。