#node.js #reactjs #npm #azure-devops #npm-install
#node.js #reactjs #npm #azure-devops #npm-установка
Вопрос:
Я создал один конвейер сборки с двумя задачами npm, установщиком, а затем пользовательским скриптом с аргументами run-script build, как видно на скриншоте
Однако я получаю ошибки, и это есть в журналах
##[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:windowssystem32cmd.exe /D /S /C "C:npmprefixnpm.cmd --version"
6.8.0
[command]C:windowssystem32cmd.exe /D /S /C "C:npmprefixnpm.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 Filesnodejsnode.exe
; cwd = D:a1s
; HOME = C:UsersVssAdministrator
; "npm config ls -l" to show all defaults.
[command]C:windowssystem32cmd.exe /D /S /C "C:npmprefixnpm.cmd run-script build"
npm ERR! code ELIFECYCLE
npm ERR! errno 1
> isomorphic@2.6.0 build D:a1s
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:npmcache_logs2019-03-18T22_28_26_738Z-debug.log
Found npm debug log, make sure the path matches with the one in npm's output: C:npmcache_logs2019-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:npmprefixnode_modulesnpmnode_modulesnpm-lifecyclenode-gyp-bin;D:a1snode_modules.bin;C:agents2.148.1externalsgitcmd;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 FilesBoost1.69.0;C:UsersVssAdministrator.dotnettools;C:Program Filesdotnet;C:mysql-5.7.21-winx64bin;C:Program FilesJavazulu-8-azure-jdk_8.36.0.1-8.0.202-win_x64bin;C:npmprefix;C:hostedtoolcachewindowsRuby2.5.0x64bin;C:Go1.11.5bin;C:Program FilesGitbin;C:Program FilesGitusrbin;C:Program FilesGitmingw64bin;C:Program Files (x86)Microsoft SDKsAzureCLI2wbin;C:Program Files (x86)Microsoft Visual StudioSharedPython36_64Scripts;C:Program Files (x86)Microsoft Visual StudioSharedPython36_64;C:Program FilesMicrosoft MPIBin;C:windowssystem32;C:windows;C:windowsSystem32Wbem;C:windowsSystem32WindowsPowerShellv1.0;C:ProgramDataChocolateybin;C:Program FilesDocker;C:Program FilesPowerShell6;C:Program Filesdotnet;C:Program FilesMicrosoft SQL Server130ToolsBinn;C:Program Files (x86)Microsoft SQL Server110DTSBinn;C:Program Files (x86)Microsoft SQL Server120DTSBinn;C:Program Files (x86)Microsoft SQL Server130DTSBinn;C:Program Files (x86)Microsoft SQL Server140DTSBinn;C:Program Files (x86)Microsoft SQL Server150DTSBinn;C:Program Files (x86)Windows Kits10Windows Performance Toolkit;C:Program FilesMicrosoft Service FabricbinFabricFabric.Code;C:Program FilesMicrosoft SDKsService FabricToolsServiceFabricLocalClusterManager;C:Program FilesGitcmd;C:Program FilesGitmingw64bin;C:Program FilesGitusrbin;c:toolsphp;C:Program Files (x86)Subversionbin;C:Program Filesnodejs;C:Program FilesCMakebin;C:Program FilesMercurial;C:Strawberrycbin;C:Strawberryperlsitebin;C:Strawberryperlbin;C:Program FilesOpenSSLbin;C:UsersVssAdministratorAppDataLocalMicrosoftWindowsApps;
9 verbose lifecycle isomorphic@2.6.0~build: CWD: D:a1s
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:npmprefixnode_modulesnpmnode_modulesnpm-lifecycleindex.js:301:16)
13 verbose stack at EventEmitter.emit (events.js:189:13)
13 verbose stack at ChildProcess.<anonymous> (C:npmprefixnode_modulesnpmnode_modulesnpm-lifecyclelibspawn.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:a1s
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"
}
}
Комментарии:
1. Похоже, что ваш
react-app-rewired build
скрипт потерпел неудачу. Не удается прочитать свойство ‘thisCompilation’ undefined , о котором говорится; что там происходит?
Ответ №1:
Ошибка довольно очевидна… посмотрите на свой журнал. Есть такая строка:
Cannot read property 'thisCompilation' of undefined
Итак, внутри вашего кода не показано, где именно, в вашей логике ошибка, и у вас может быть указатель null, поэтому компилятор Javascript терпит неудачу.
У меня была похожая проблема, которая была исправлена в коде приложения, предупреждение / ошибка, которая не была обнаружена в средах разработки, только мы пытались выполнить сборку в конвейере azure.
Я надеюсь, что это поможет другим с подобной проблемой.