Angular dependency errors, during pipeline

Viewed 60

The following chain of events had occured.

The Angular website application was pretty outdated, possibly v3 and was upgraded to 8.2.8, couldnt go all the way due to a dependency on mdbbootstrap which would require a rewrite in many places, made a change and the pipeline and check completed.

Coming back from another project i ran into this problem Angular project produces javascript error "core.js:23018 Uncaught TypeError: Cannot read properties of undefined (reading 'id')", which was solved by npm -ci

Now after making my current changes, and sending off to gitlab pipeline, the following errors occur

npm ERR! While resolving: angular-date-value-accessor@0.0.1
npm ERR! Found: @angular/core@8.2.14
npm ERR! node_modules/@angular/core
npm ERR!   @angular/core@"~8.2.8" from the root project
npm ERR!   peer @angular/core@"8.2.14" from @angular/animations@8.2.14
npm ERR!   node_modules/@angular/animations
npm ERR!     @angular/animations@"~8.2.8" from the root project
npm ERR!     peer @angular/animations@">=6.0.0 <9.0.0" from angular-calendar@0.26.11
npm ERR!     node_modules/angular-calendar
npm ERR!       angular-calendar@"^0.26.11" from the root project
npm ERR!   23 more (@angular/common, @angular/forms, ...)
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/core@"^2.0.0" from angular-date-value-accessor@0.0.1
npm ERR! node_modules/angular-date-value-accessor
npm ERR!   angular-date-value-accessor@"0.0.1" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: @angular/core@2.4.10
npm ERR! node_modules/@angular/core
npm ERR!   peer @angular/core@"^2.0.0" from angular-date-value-accessor@0.0.1
npm ERR!   node_modules/angular-date-value-accessor
npm ERR!     angular-date-value-accessor@"0.0.1" from the root project

this is the gitlab-ci yaml

stage: build_staging
    image: node:lts
    script:
        - grep -rli '%COMMIT_HASH%' * | xargs -i@ sed -i "s/%COMMIT_HASH%/$CI_COMMIT_SHORT_SHA/g" @
        - cd src/Web
        - npm install
        - npm run buildstaging
    artifacts:
        paths:
            - src/Web/dist/
        name: "$CI_JOB_NAME-$CI_COMMIT_REF_NAME"
    only:
        refs:
            - develop

Deploy Web Staging:
    stage: deploy_staging
    image: xueshanf/awscli
    script:
        - cd src/Web
        - aws s3 sync ./dist s3://$STAGING_BUCKET_NAME/ --delete
        - echo "Invalidate index.html"
        - aws cloudfront create-invalidation --distribution-id $STAGING_DISTRIBUTION_ID --paths /index.html
    only:
        refs:
            - develop

(fyi its the build_staging that is the problem)

I am assuming what was fixed on my local machine is now no longer valid for npm install on npm:lts

What would be the proper course of direction, is it as simple as npm ci( a very demanding operation) instead of npm install ? or git clean ?

I also noticed, although everything works fine locally in package.json and lock it has

"@angular/core": "~8.2.8",

but in my node_modules it has 8.2.14 in /@angular/core/

after running npm ci

1 Answers

ok here is what i did to get it working. This would not be a problem if ng commands would work so it could auto resolve dependency problems. Each problem gitlab complained about i manually uninstalled and installed to see the error, and its dependency issue. I upgraded either the component or dependency. until all were gone. Some components had to go completely, but none required a re-code of any usage (i think so far, it hasnt been fully tested).

Now when i finally resolved all these issues, i would get errors such as this

npm ERR! path /builds/0/WebSites/customerportal/CustomerPortal/src/Web/node_modules/node-sass
npm ERR! command failed
npm ERR! command sh -c node scripts/build.js

npm ERR! Building: /usr/local/bin/node /builds/0/WebSites/customerportal/CustomerPortal/src/Web/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=

allot more all pointing to gyp, and some problem with python version.

I changed the version of the image to Node:14 in the yaml file, and the building stage would complete. Also, the deploy stage would complete, (but the C# api layers time out on warning: 8 tasks failed to start

Related