I am building an Angular 8.5.5 project in Azure DevOps, which deployed successfully in the past. Recently I tried publishing it again and now getting
An unhandled exception occurred: Cannot find module './features/colr-v1' Npm failed with return code: 127
Except, of course, there is no features/colr module (I even tried adding it, but that made no difference)
It fails on the step "Prod Build" but this step works fine locally. Any clues?
run ng build --prod
So far I've tried the suggestions found here: How to resolve Azure Pipeline Error: Npm failed with return code: 1, npm install task. SyntaxError: Unexpected end of JSON input while parsing near
(delete packages.lock, forced the cache clear locally, dropped the modules folder) works locally, but dies on the build server...
2022-05-26T21:23:43.4078903Z ##[section]Starting: Prod build
2022-05-26T21:23:43.4200582Z ==============================================================================
2022-05-26T21:23:43.4200910Z Task : npm
2022-05-26T21:23:43.4201263Z Description : Install and publish npm packages, or run an npm command. Supports npmjs.com and authenticated registries like Azure Artifacts.
2022-05-26T21:23:43.4201635Z Version : 1.202.0
2022-05-26T21:23:43.4201841Z Author : Microsoft Corporation
2022-05-26T21:23:43.4202130Z Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/package/npm
2022-05-26T21:23:43.4202490Z ==============================================================================
2022-05-26T21:23:44.4762030Z [command]C:\Windows\system32\cmd.exe /D /S /C "C:\hostedtoolcache\windows\node\16.15.0\x64\npm.cmd --version"
2022-05-26T21:23:45.5190169Z 8.5.5
2022-05-26T21:23:47.5735442Z [command]C:\Windows\system32\cmd.exe /D /S /C "C:\hostedtoolcache\windows\node\16.15.0\x64\npm.cmd config list"
2022-05-26T21:23:48.5878213Z ; "global" config from C:\npm\prefix\etc\npmrc
2022-05-26T21:23:48.5878806Z
2022-05-26T21:23:48.5879227Z cache = "C:\\npm\\cache"
2022-05-26T21:23:48.5879455Z
2022-05-26T21:23:48.5879831Z ; "env" config from environment
2022-05-26T21:23:48.5880055Z
2022-05-26T21:23:48.5880412Z prefix = "C:\\npm\\prefix"
2022-05-26T21:23:48.5880833Z userconfig = "D:\\a\\1\\npm\\140.npmrc"
2022-05-26T21:23:48.5881068Z
2022-05-26T21:23:48.5881511Z ; node bin location = C:\hostedtoolcache\windows\node\16.15.0\x64\node.exe
2022-05-26T21:23:48.5881972Z ; cwd = D:\a\1\s
2022-05-26T21:23:48.5882348Z ; HOME = C:\Users\VssAdministrator
2022-05-26T21:23:48.5882787Z ; Run `npm config ls -l` to show all defaults.
2022-05-26T21:23:48.5886667Z [command]C:\Windows\system32\cmd.exe /D /S /C "C:\hostedtoolcache\windows\node\16.15.0\x64\npm.cmd run ng build --prod"
2022-05-26T21:23:52.2011491Z An unhandled exception occurred: Cannot find module './features/colr-v1'
2022-05-26T21:23:52.2011799Z
2022-05-26T21:23:52.2012498Z Require stack:
2022-05-26T21:23:52.2012829Z > [email protected] ng
2022-05-26T21:23:52.2013380Z - D:\a\1\s\node_modules\caniuse-lite\data\features.js
2022-05-26T21:23:52.2013697Z > ng "build"
2022-05-26T21:23:52.2014190Z - D:\a\1\s\node_modules\caniuse-lite\dist\unpacker\features.js
2022-05-26T21:23:52.2014375Z
2022-05-26T21:23:52.2014980Z - D:\a\1\s\node_modules\caniuse-lite\dist\unpacker\index.js
2022-05-26T21:23:52.2016272Z - D:\a\1\s\node_modules\@angular-devkit\build-angular\src\utils\build-browser-features.js
2022-05-26T21:23:52.2017336Z - D:\a\1\s\node_modules\@angular-devkit\build-angular\src\utils\index.js
2022-05-26T21:23:52.2018363Z - D:\a\1\s\node_modules\@angular-devkit\build-angular\src\browser\index.js
2022-05-26T21:23:52.2019402Z - D:\a\1\s\node_modules\@angular-devkit\architect\node\node-modules-architect-host.js
2022-05-26T21:23:52.2020422Z - D:\a\1\s\node_modules\@angular-devkit\architect\node\index.js
2022-05-26T21:23:52.2021382Z - D:\a\1\s\node_modules\@angular\cli\models\architect-command.js
2022-05-26T21:23:52.2022552Z - D:\a\1\s\node_modules\@angular\cli\commands\build-impl.js
2022-05-26T21:23:52.2023515Z - D:\a\1\s\node_modules\@angular-devkit\schematics\tools\export-ref.js
2022-05-26T21:23:52.2024504Z - D:\a\1\s\node_modules\@angular-devkit\schematics\tools\index.js
2022-05-26T21:23:52.2025476Z - D:\a\1\s\node_modules\@angular\cli\utilities\json-schema.js
2022-05-26T21:23:52.2026423Z - D:\a\1\s\node_modules\@angular\cli\models\command-runner.js
2022-05-26T21:23:52.2027362Z - D:\a\1\s\node_modules\@angular\cli\lib\cli\index.js
2022-05-26T21:23:52.2028297Z - D:\a\1\s\node_modules\@angular\cli\lib\init.js
2022-05-26T21:23:52.2029191Z - D:\a\1\s\node_modules\@angular\cli\bin\ng
2022-05-26T21:23:52.2030184Z See "C:\Users\VSSADM~1\AppData\Local\Temp\ng-2wWjsm\angular-errors.log" for further details.
2022-05-26T21:23:52.2445104Z ##[warning]Couldn't find a debug log in the cache or working directory
2022-05-26T21:23:52.2457516Z ##[error]Error: Npm failed with return code: 127
2022-05-26T21:23:52.2468571Z ##[section]Finishing: Prod b
CodePudding user response:
I think you have to install colr-v1 module using npm install
CodePudding user response:
The solution was arrived at by completely blowing away my local environment and pulling the code from the repo anew. I was then able to see the errors in the dependency chain. Hope this helps someone
this worked for now: I'll have to update some libraries later. npm install --legacy-peer-deps