我正在尝试在 vercel 上部署,之前它工作正常,直到我添加了一个名为 leaflet 的 map 库,现在它在部署中出现错误。我尝试在终端中运行 npm run build 但仍然出现错误.
[10:00:20.566] Cloning github.com/daviroquedev/ride (Branch: master, Commit: 7e7d760)
[10:00:21.284] Cloning completed: 717.186ms
[10:00:21.853] Looking up build cache...
[10:00:22.163] Build Cache not found
[10:00:22.217] Running "vercel build"
[10:00:22.881] Vercel CLI 28.4.2
[10:00:23.187] Installing dependencies...
[10:00:23.831] npm ERR! must provide string spec
[10:00:23.834]
[10:00:23.835] npm ERR! A complete log of this run can be found in:
[10:00:23.835] npm ERR! /vercel/.npm/_logs/2022-09-27T13_00_23_618Z-debug-0.log
[10:00:23.850] Detected `package-lock.json` generated by npm 7+...
[10:00:23.850] Running "npm run build"
[10:00:24.243]
[10:00:24.243] > <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="a1d3c8c5c4e1918f918f91" rel="noreferrer noopener nofollow">[email protected]</a> build
[10:00:24.244] > vite build
[10:00:24.244]
[10:00:24.251] sh: vite: command not found
[10:00:24.259] Error: Command "npm run build" exited with 127
构建失败 命令“npm run build”以 127 退出
PACKAGE.JSON
最佳答案
如果您在构建 npm 项目时遇到任何问题,尝试重新安装所有软件包始终是一个好计划。
第一步应该始终是简单地运行 npm i
。
如果这不起作用,请尝试删除 package-json.lock
并删除 .node_modules
,然后再次运行 npm i
。
关于deployment - Vercel 127 部署 Vercel 应用程序时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/73868105/