How to create an Azure Devops Buildpipeline for a

2019-07-24 17:43发布

问题:

I have created one build pipeline with 2 npm tasks, the installer and then custom script with arguments run-script build, as seen in the screenshot

However I get errors and this is in the logs

##[section]Starting: npm custom
==============================================================================
Task         : npm
Description  : Install and publish npm packages, or run an npm command. Supports npmjs.com and authenticated registries like Package Management.
Version      : 1.148.0
Author       : Microsoft Corporation
Help         : [More Information](https://go.microsoft.com/fwlink/?LinkID=613746)
==============================================================================
SYSTEMVSSCONNECTION exists true
SYSTEMVSSCONNECTION exists true
[command]C:\windows\system32\cmd.exe /D /S /C "C:\npm\prefix\npm.cmd --version"
6.8.0
[command]C:\windows\system32\cmd.exe /D /S /C "C:\npm\prefix\npm.cmd config list"
; cli configs
metrics-registry = "https://registry.npmjs.org/"
scope = ""
user-agent = "npm/6.8.0 node/v10.15.2 win32 x64"

; environment configs
cache = "C:\\npm\\cache"
prefix = "C:\\npm\\prefix"
userconfig = "D:\\a\\1\\npm\\94.npmrc"

; builtin config undefined

; node bin location = C:\Program Files\nodejs\node.exe
; cwd = D:\a\1\s
; HOME = C:\Users\VssAdministrator
; "npm config ls -l" to show all defaults.

[command]C:\windows\system32\cmd.exe /D /S /C "C:\npm\prefix\npm.cmd run-script build"
npm ERR! code ELIFECYCLE

npm ERR! errno 1
> isomorphic@2.6.0 build D:\a\1\s
npm ERR! isomorphic@2.6.0 build: `react-app-rewired build`
> react-app-rewired build
npm ERR! Exit status 1

npm ERR! 
Creating an optimized production build...
npm ERR! Failed at the isomorphic@2.6.0 build script.
Failed to compile.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.


Cannot read property 'thisCompilation' of undefined
npm ERR! A complete log of this run can be found in:

npm ERR!     C:\npm\cache\_logs\2019-03-18T22_28_26_738Z-debug.log

Found npm debug log, make sure the path matches with the one in npm's output: C:\npm\cache\_logs\2019-03-18T22_28_26_738Z-debug.log
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\npm\\prefix\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'run-script',
1 verbose cli   'build' ]
2 info using npm@6.8.0
3 info using node@v10.15.2
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle isomorphic@2.6.0~prebuild: isomorphic@2.6.0
6 info lifecycle isomorphic@2.6.0~build: isomorphic@2.6.0
7 verbose lifecycle isomorphic@2.6.0~build: unsafe-perm in lifecycle true
8 verbose lifecycle isomorphic@2.6.0~build: PATH: C:\npm\prefix\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;D:\a\1\s\node_modules\.bin;C:\agents\2.148.1\externals\git\cmd;C:/hostedtoolcache/windows/Python/3.6.8/x64;C:/hostedtoolcache/windows/Python/3.6.8/x64/Scripts;C:\vcpkg;C:\cf-cli;C:\Program Files (x86)\NSIS\;C:\Program Files\Boost\1.69.0;C:\Users\VssAdministrator\.dotnet\tools;C:\Program Files\dotnet;C:\mysql-5.7.21-winx64\bin;C:\Program Files\Java\zulu-8-azure-jdk_8.36.0.1-8.0.202-win_x64\bin;C:\npm\prefix;C:\hostedtoolcache\windows\Ruby\2.5.0\x64\bin;C:\Go1.11.5\bin;C:\Program Files\Git\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin;C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\Scripts;C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64;C:\Program Files\Microsoft MPI\Bin\;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\ProgramData\Chocolatey\bin;C:\Program Files\Docker;C:\Program Files\PowerShell\6\;C:\Program Files\dotnet\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\110\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\130\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\140\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\150\DTS\Binn\;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Program Files\Microsoft Service Fabric\bin\Fabric\Fabric.Code;C:\Program Files\Microsoft SDKs\Service Fabric\Tools\ServiceFabricLocalClusterManager;C:\Program Files\Git\cmd;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;c:\tools\php;C:\Program Files (x86)\Subversion\bin;C:\Program Files\nodejs\;C:\Program Files\CMake\bin;C:\Program Files\Mercurial;C:\Strawberry\c\bin;C:\Strawberry\perl\site\bin;C:\Strawberry\perl\bin;C:\Program Files\OpenSSL\bin;C:\Users\VssAdministrator\AppData\Local\Microsoft\WindowsApps;
9 verbose lifecycle isomorphic@2.6.0~build: CWD: D:\a\1\s
10 silly lifecycle isomorphic@2.6.0~build: Args: [ '/d /s /c', 'react-app-rewired build' ]
11 silly lifecycle isomorphic@2.6.0~build: Returned: code: 1  signal: null
12 info lifecycle isomorphic@2.6.0~build: Failed to exec build script
13 verbose stack Error: isomorphic@2.6.0 build: `react-app-rewired build`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (C:\npm\prefix\node_modules\npm\node_modules\npm-lifecycle\index.js:301:16)
13 verbose stack     at EventEmitter.emit (events.js:189:13)
13 verbose stack     at ChildProcess.<anonymous> (C:\npm\prefix\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:189:13)
13 verbose stack     at maybeClose (internal/child_process.js:970:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
14 verbose pkgid isomorphic@2.6.0
15 verbose cwd D:\a\1\s
16 verbose Windows_NT 10.0.14393
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\npm\\prefix\\node_modules\\npm\\bin\\npm-cli.js" "run-script" "build"
18 verbose node v10.15.2
19 verbose npm  v6.8.0
20 error code ELIFECYCLE
21 error errno 1
22 error isomorphic@2.6.0 build: `react-app-rewired build`
22 error Exit status 1
23 error Failed at the isomorphic@2.6.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
##[section]Finishing: npm custom

package.json

{
  "name": "isomorphic",
  "version": "2.6.0",
  "private": true,
  "dependencies": {
    "adal-angular": "^1.0.17",
    "antd": "^3.0.3",
    "antd-local-icon": "^0.1.3",
    "axios": "^0.18.0",
    "classnames": "^2.2.5",
    "clone": "^2.1.1",
    "history": "^4.6.3",
    "nprogress": "^0.2.0",
    "postcss-inline-rtl": "^0.9.8",
    "q": "^1.5.1",
    "react": "^16.2.0",
    "react-adal": "^0.4.17",
    "react-dom": "^16.2.0",
    "react-highlight-words": "^0.16.0",
    "react-intl": "^2.3.0",
    "react-placeholder": "^2.0.0",
    "react-redux": "^5.0.4",
    "react-router": "^4.1.1",
    "react-router-dom": "^4.1.0",
    "react-router-redux": "^5.0.0-alpha.5",
    "react-scripts": "1.0.17",
    "react-sidebar": "^2.3.2",
    "react-smooth-scrollbar": "^8.0.6",
    "react-throttle": "^0.3.0",
    "react-window-size-listener": "^1.0.10",
    "redux": "^3.6.0",
    "redux-devtools": "^3.3.2",
    "redux-devtools-dock-monitor": "^1.1.1",
    "redux-devtools-log-monitor": "^1.2.0",
    "redux-saga": "^0.16.0",
    "redux-thunk": "^2.2.0",
    "smooth-scrollbar": "^8.2.5",
    "styled-components": "^2.2.1",
    "styled-theme": "^0.3.3",
    "webpack-cli": "^3.2.3"
  },
  "devDependencies": {
    "react-app-rewired": "^1.4.0",
    "webpack": "^4.29.5"
  },
  "scripts": {
    "start": "react-app-rewired start",
    "build": "react-app-rewired build",
    "test": "react-app-rewired test --env=jsdom",
    "eject": "react-scripts eject"
  }
}