【发布时间】:2020-06-11 06:52:56
【问题描述】:
我有一个在本地运行良好的 reactJS 应用程序。但是最近,当通过 AzureDevOps 上的管道构建相同的代码时,构建失败了。
谁能告诉我为什么会这样?
请在构建实例的 npm run 构建任务日志下方找到,
Starting: npm run build
==============================================================================
Task : npm
Description : Install and publish npm packages, or run an npm command. Supports npmjs.com and
authenticated registries like Azure Artifacts.
Version : 1.169.2
Author : Microsoft Corporation
Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/package/npm
==============================================================================
SYSTEMVSSCONNECTION exists true
SYSTEMVSSCONNECTION exists true
/usr/local/bin/npm --version
6.14.5
/usr/local/bin/npm config list
; cli configs
metrics-registry = "https://registry.npmjs.org/"
scope = ""
user-agent = "npm/6.14.5 node/v12.18.0 linux x64"
; environment configs
userconfig = "/home/vsts/work/1/npm/20420.npmrc"
; node bin location = /usr/local/bin/node
; cwd = /home/vsts/work/1/s/client
/usr/local/bin/npm run build
error Generating JavaScript bundles failed
[BABEL] /home/vsts/work/1/s/client/.cache/production-app.js: No "exports" main resolved in
/home/vsts/work/1/s/client/node_modules/@babel/helper-compilation-targets/package.json
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! website-company@0.1.0 build: `cross-env GATSBY_THEME=brand gatsby build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the website-company@0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/vsts/.npm/_logs/2020-06-11T05_31_44_848Z-debug.log
> website-company@0.1.0 build /home/vsts/work/1/s/client
> cross-env GATSBY_THEME=brand gatsby build
2 info using npm@6.14.5
3 info using node@v12.18.0
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle website-company@0.1.0~prebuild: website-company@0.1.0
6 info lifecycle website-company@0.1.0~build: website-company@0.1.0
7 verbose lifecycle website-company@0.1.0~build: unsafe-perm in lifecycle true
8 verbose lifecycle website-company@0.1.0~build: PATH:
/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-
bin:/home/vsts/work/1/s/client/node_modules/.bin:/usr/share/rust/.cargo/bin:/home/runner/.config/composer/vendor/bin:/ home/runner/.dotnet/tools:/snap/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/ usr/local/games:/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin 9 详细生命周期 website-company@0.1.0~build: CWD: /home/vsts/work/1/s/client 10 愚蠢的生命周期 website-company@0.1.0~build: Args: [ '-c', 'cross-env GATSBY_THEME=brand 盖茨比构建'] 11 愚蠢的生命周期 website-company@0.1.0~build: Returned: code: 1 signal: null 12 info 生命周期 website-company@0.1.0~build: 无法执行构建脚本
13 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-
lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:315:20)
13 verbose stack at maybeClose (internal/child_process.js:1021:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
14 verbose pkgid website-company@0.1.0
15 verbose cwd /home/vsts/work/1/s/client
16 verbose Linux 4.15.0-1083-azure
17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "build"
18 verbose node v12.18.0
19 verbose npm v6.14.5
20 error code ELIFECYCLE
21 error errno 1
22 error website-company@0.1.0 build: `cross-env GATSBY_THEME=brand gatsby build`
22 error Exit status 1
23 error Failed at the website-company@0.1.0 build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
##[error]Error: Npm failed with return code: 1
Finishing: npm run build
【问题讨论】:
标签: reactjs npm azure-devops