我在我的專案中使用 parcel-bundler 進行 sass,我一直使用 npm start 而不是 npm run build 并且它一直對我有用。但是這一次,當我嘗試在 Vercel 上部署我的專案時,它失敗了,并顯示“錯誤:命令“npm run build”以 127 退出”?
我已經嘗試使用 Vercel CLI 將 CI 環境變數設定為 false,但它仍然給我相同的結果。
包.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
uj5u.com熱心網友回復:
您正在使用 Parcel,但它未在您的 devDependencies 中列出。我的猜測是你已經在全球范圍內安裝了它。嘗試將其添加為本地 devDependency:
npm install --save-dev parcel
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/489805.html
