Reputation: 657
I have a reactJS App which is working fine locally. But recently the build is failing when the same code is build via pipeline on AzureDevOps.
Can one please let me know why this could be?
Please find below the npm run build task logs from the build instance,
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://learn.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! [email protected] build: `cross-env GATSBY_THEME=brand gatsby build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] 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
> [email protected] build /home/vsts/work/1/s/client
> cross-env GATSBY_THEME=brand gatsby build
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle [email protected]~prebuild: [email protected]
6 info lifecycle [email protected]~build: [email protected]
7 verbose lifecycle [email protected]~build: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~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 verbose lifecycle [email protected]~build: CWD: /home/vsts/work/1/s/client 10 silly lifecycle [email protected]~build: Args: [ '-c', 'cross-env GATSBY_THEME=brand gatsby build' ] 11 silly lifecycle [email protected]~build: Returned: code: 1 signal: null 12 info lifecycle [email protected]~build: Failed to exec build script
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 [email protected]
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 [email protected] build: `cross-env GATSBY_THEME=brand gatsby build`
22 error Exit status 1
23 error Failed at the [email protected] 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
Upvotes: 0
Views: 980
Reputation: 76670
production-app.js: No "exports" main resolved in /home/vsts/work/1/s/client/node_modules/@babel/helper-compilation-targets/package.json
According to the error message, it seems the issue from a regression in Node.js
or the version of babel
, please try to following suggestions to resolve this issue:
You could check this thread for some more details.
Hope this helps.
Upvotes: 1