bcgov / bc-wallet-mobile

BC Wallet to hold Verifiable Credentials
Apache License 2.0
60 stars 46 forks source link

CI/CD - npm ci - fails due to npx patch-package #766

Closed dinbtechit closed 1 year ago

dinbtechit commented 1 year ago

Unable to build wallet/bifold in CI/CD pipeline looks like its not able to find the react packages while applying the patch. Has anyone seen this issue before?

The CI/CD runs on a fork of bc-wallet-mobile. The only thing the pipeline does not have is the npm cache.

I tried building the root of the project

npm ci

and with the app folder. Both got the same error

cd app/
npm ci

Error

> aries-bifold@0.0.1 postinstall
> npx patch-package

patch-package 6.4.7
Applying patches...
Error: Patch file found for package react-hooks which is not present at node_modules/@aries-framework/react-hooks
Error: Patch file found for package react-native-gifted-chat which is not present at node_modules/react-native-gifted-chat
---
patch-package finished with 2 error(s).
npm ERR! code 1
npm ERR! path /Users/runner/work/1/s/bifold/core
npm ERR! command failed
npm ERR! command sh -c -- npx patch-package

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/runner/.npm/_logs/2022-11-30T14_22_15_653Z-debug-0.log
npm ERR! code 1
npm ERR! path /Users/runner/work/1/s/bifold/core
npm ERR! command failed
npm ERR! command sh -c -- npx patch-package
npm ERR! patch-package 6.4.7
npm ERR! Applying patches...
npm ERR! Error: Patch file found for package react-hooks which is not present at node_modules/@aries-framework/react-hooks
npm ERR! Error: Patch file found for package react-native-gifted-chat which is not present at node_modules/react-native-gifted-chat
npm ERR! ---
npm ERR! patch-package finished with 2 error(s).

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/runner/.npm/_logs/2022-11-30T14_23_02_617Z-debug-0.log
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated mkdirp@0.5.3: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
npm WARN deprecated debug@4.1.1: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
npm ERR! code 1
npm ERR! path /Users/runner/work/1/s/bifold/core
npm ERR! command failed
npm ERR! command sh -c -- npx patch-package
npm ERR! patch-package 6.4.7
npm ERR! Applying patches...
npm ERR! Error: Patch file found for package react-hooks which is not present at node_modules/@aries-framework/react-hooks
npm ERR! Error: Patch file found for package react-native-gifted-chat which is not present at node_modules/react-native-gifted-chat
npm ERR! ---
npm ERR! patch-package finished with 2 error(s).

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/runner/.npm/_logs/2022-11-30T14_24_20_205Z-debug-0.log
##[error]The process '/bin/bash' failed with exit code 1
##[error]Bash failed with error: The process '/bin/bash' failed with exit code 1
##[section]Finishing: Post Clone Script
dinbtechit commented 1 year ago

Turns out that in CI environment - bifold -> core -> node_modules folder does not exist. So I had to install @aries-framework manually

cd bifold/core
npm i @aries-framework/react-hooks@0.3.0 --force

Hope this helps someone else facing the same issue.