在我的psake任务中,以下命令:
exec { npm install --no-optional --no-shrinkwrap --no-package-lock }
exec { npm run prod-build }
使用此npm脚本:
"prod-build": "webpack --config ./webpack.prod.js --display errors-only"
给出以下错误并使我的脚本失败:
89 char:12 + exec { npm run prod-build } + ~~~~~~~~~~~~~~~~~~ [<<==>>] Exception: clean-webpack-plugin: <projectdir>\Build\release\scripts\dist has been removed.
这不是错误或失败,所以我不确定为什么它会导致构建失败。
当我将npm run命令调整为以下命令时(不再使用psake的exec):
npm run prod-build
Write-Host "Run exit code: $lastexitcode"
我收到相同的错误消息,但没有打到Write-Host
行。当我尝试以下操作时:
npm run prod-build -verbose
Write-Host "Run exit code: $lastexitcode"
我收到此错误(同样没有退出代码)”
Error: 8/15/2018 10:25:03 AM:
At C:\workspace\vso\hop_hospiceorderportal\build\psake.ps1:92 char:5 + npm run prod-build -verbose + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ [<<==>>] Exception: npm info it worked if it ends with
ok
psake.ps1 failed
当我直接在控制台中运行npm run prod-build
命令时,它会按预期工作。好像有psake的东西正在扔掉它。