部署到 Vercel 时出错(错误:命令"npm run build"退出,并显示 127)



我在我的项目中使用package -bundler,我一直使用npm start而不是npm run build,它一直为我工作。但这一次,当我试图在Vercel上部署我的项目时,它失败了,它说"错误:命令"npm run build"以127"退出?

我已经尝试使用Vercel CLI将CI环境变量设置为false,但它仍然给我相同的结果。

package.json

{
"name": "portfolio",
"version": "1.0.0",
"description": "",
"source": "src/index.html",
"scripts": {
"start": "parcel src/index.html",
"build": "parcel build src/index.html"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"sass": "^1.52.2"
}
}
[21:07:21.022] Cloning completed: 371.994ms
[21:07:21.103] Installing build runtime...
[21:07:22.998] Build runtime installed: 1.894s
[21:07:23.868] No Build Cache available
[21:07:24.021] Installing dependencies...
[21:07:25.307] 
[21:07:25.308] added 17 packages in 1s
[21:07:25.308] 
[21:07:25.308] 2 packages are looking for funding
[21:07:25.308]   run `npm fund` for details
[21:07:25.510] Detected `package-lock.json` generated by npm 7...
[21:07:25.510] Running "npm run build"
[21:07:25.783] 
[21:07:25.784] > portfolio@1.0.0 build
[21:07:25.784] > parcel build src/index.html
[21:07:25.784] 
[21:07:25.789] sh: parcel: command not found
[21:07:25.798] Error: Command "npm run build" exited with 127

您正在使用Parcel,但它没有在您的devDependencies中列出。我猜您已经在全局安装了它。尝试将其添加为本地devDependency:

npm install --save-dev parcel

相关内容