node.jsnpmnpm-installbitbucket-pipelines

I'm having trouble installing npm and Angular CLI within a Bitbucket Pipeline


The following commands execute just fine in my local development environment:

npm install -g
npm install -g @angular/cli

Local Workstation

But here's what happens when I try to do this within a Bitbucket pipeline:

- step:
    name: Web Admin Portal Deployment
    caches:
      - node
    script:
      - cd Admin
      - npm install -g
      - npm install -g @angular/cli
      - ng build --configuration staging

Bitbucket Pipeline

+ npm install -g @angular/cli
npm ERR! code EUNSUPPORTEDPROTOCOL
npm ERR! Unsupported URL Type "npm:": npm:string-width@^4.2.0
npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2024-09-25T19_58_43_985Z-debug.log
npm ERR! code EUNSUPPORTEDPROTOCOL
npm ERR! Unsupported URL Type "npm:": npm:string-width@^4.2.0
npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2024-09-25T19_58_43_985Z-debug.log

No the truth is, although it did not break the script, the first npm install -g did not run cleanly, as it did on my local workstation. Here are the details, when I expand this section.

Any idea what I need to do to get this to runs cleanly within the Bitbucket pipeline? Thanks!

Edit: This might be a clue. I threw a command in there to output the version of node:

node -v

v8.9.4

Yikes! That's quite old! On my workstation I am running v20.15.1

How can I get a more recent version of Node installed in the pipeline?

+ npm install -g
npm WARN lifecycle esbuild@0.18.20~postinstall: cannot run in wd %s %s (wd=%s) esbuild@0.18.20 node install.js /opt/atlassian/pipelines/agent/build/Admin/node_modules/esbuild
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.3.2 (../../../../../../opt/atlassian/pipelines/agent/build/Admin/node_modules/vite/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @esbuild/android-arm@0.18.20 (../../../../../../opt/atlassian/pipelines/agent/build/Admin/node_modules/esbuild/node_modules/@esbuild/android-arm):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @esbuild/android-arm@0.18.20: wanted {"os":"android","arch":"arm"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @esbuild/android-x64@0.18.20 (../../../../../../opt/atlassian/pipelines/agent/build/Admin/node_modules/esbuild/node_modules/@esbuild/android-x64):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @esbuild/android-x64@0.18.20: wanted {"os":"android","arch":"x64"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @esbuild/sunos-x64@0.18.20 (../../../../../../opt/atlassian/pipelines/agent/build/Admin/node_modules/esbuild/node_modules/@esbuild/sunos-x64):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @esbuild/sunos-x64@0.18.20: wanted {"os":"sunos","arch":"x64"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @esbuild/linux-arm@0.18.20 (../../../../../../opt/atlassian/pipelines/agent/build/Admin/node_modules/esbuild/node_modules/@esbuild/linux-arm):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @esbuild/linux-arm@0.18.20: wanted {"os":"linux","arch":"arm"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @esbuild/win32-ia32@0.18.20 (../../../../../../opt/atlassian/pipelines/agent/build/Admin/node_modules/esbuild/node_modules/@esbuild/win32-ia32):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @esbuild/win32-ia32@0.18.20: wanted {"os":"win32","arch":"ia32"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @esbuild/netbsd-x64@0.18.20 (../../../../../../opt/atlassian/pipelines/agent/build/Admin/node_modules/esbuild/node_modules/@esbuild/netbsd-x64):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @esbuild/netbsd-x64@0.18.20: wanted {"os":"netbsd","arch":"x64"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @esbuild/linux-ia32@0.18.20 (../../../../../../opt/atlassian/pipelines/agent/build/Admin/node_modules/esbuild/node_modules/@esbuild/linux-ia32):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @esbuild/linux-ia32@0.18.20: wanted {"os":"linux","arch":"ia32"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @esbuild/darwin-x64@0.18.20 (../../../../../../opt/atlassian/pipelines/agent/build/Admin/node_modules/esbuild/node_modules/@esbuild/darwin-x64):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @esbuild/darwin-x64@0.18.20: wanted {"os":"darwin","arch":"x64"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @esbuild/win32-x64@0.18.20 (../../../../../../opt/atlassian/pipelines/agent/build/Admin/node_modules/esbuild/node_modules/@esbuild/win32-x64):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @esbuild/win32-x64@0.18.20: wanted {"os":"win32","arch":"x64"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @esbuild/freebsd-arm64@0.18.20 (../../../../../../opt/atlassian/pipelines/agent/build/Admin/node_modules/esbuild/node_modules/@esbuild/freebsd-arm64):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @esbuild/freebsd-arm64@0.18.20: wanted {"os":"freebsd","arch":"arm64"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @esbuild/darwin-arm64@0.18.20 (../../../../../../opt/atlassian/pipelines/agent/build/Admin/node_modules/esbuild/node_modules/@esbuild/darwin-arm64):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @esbuild/darwin-arm64@0.18.20: wanted {"os":"darwin","arch":"arm64"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @esbuild/openbsd-x64@0.18.20 (../../../../../../opt/atlassian/pipelines/agent/build/Admin/node_modules/esbuild/node_modules/@esbuild/openbsd-x64):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @esbuild/openbsd-x64@0.18.20: wanted {"os":"openbsd","arch":"x64"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @esbuild/linux-s390x@0.18.20 (../../../../../../opt/atlassian/pipelines/agent/build/Admin/node_modules/esbuild/node_modules/@esbuild/linux-s390x):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @esbuild/linux-s390x@0.18.20: wanted {"os":"linux","arch":"s390x"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @esbuild/linux-loong64@0.18.20 (../../../../../../opt/atlassian/pipelines/agent/build/Admin/node_modules/esbuild/node_modules/@esbuild/linux-loong64):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @esbuild/linux-loong64@0.18.20: wanted {"os":"linux","arch":"loong64"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @esbuild/linux-ppc64@0.18.20 (../../../../../../opt/atlassian/pipelines/agent/build/Admin/node_modules/esbuild/node_modules/@esbuild/linux-ppc64):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @esbuild/linux-ppc64@0.18.20: wanted {"os":"linux","arch":"ppc64"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @esbuild/android-arm64@0.18.20 (../../../../../../opt/atlassian/pipelines/agent/build/Admin/node_modules/esbuild/node_modules/@esbuild/android-arm64):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @esbuild/android-arm64@0.18.20: wanted {"os":"android","arch":"arm64"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @esbuild/win32-arm64@0.18.20 (../../../../../../opt/atlassian/pipelines/agent/build/Admin/node_modules/esbuild/node_modules/@esbuild/win32-arm64):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @esbuild/win32-arm64@0.18.20: wanted {"os":"win32","arch":"arm64"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @esbuild/linux-arm64@0.18.20 (../../../../../../opt/atlassian/pipelines/agent/build/Admin/node_modules/esbuild/node_modules/@esbuild/linux-arm64):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @esbuild/linux-arm64@0.18.20: wanted {"os":"linux","arch":"arm64"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @esbuild/freebsd-x64@0.18.20 (../../../../../../opt/atlassian/pipelines/agent/build/Admin/node_modules/esbuild/node_modules/@esbuild/freebsd-x64):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @esbuild/freebsd-x64@0.18.20: wanted {"os":"freebsd","arch":"x64"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @esbuild/linux-mips64el@0.18.20 (../../../../../../opt/atlassian/pipelines/agent/build/Admin/node_modules/esbuild/node_modules/@esbuild/linux-mips64el):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @esbuild/linux-mips64el@0.18.20: wanted {"os":"linux","arch":"mips64el"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @esbuild/linux-riscv64@0.18.20 (../../../../../../opt/atlassian/pipelines/agent/build/Admin/node_modules/esbuild/node_modules/@esbuild/linux-riscv64):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @esbuild/linux-riscv64@0.18.20: wanted {"os":"linux","arch":"riscv64"} (current: {"os":"linux","arch":"x64"})
npm WARN @fortawesome/angular-fontawesome@0.14.1 requires a peer of @angular/core@^17.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @ng-bootstrap/ng-bootstrap@16.0.0 requires a peer of @angular/core@^17.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @ng-bootstrap/ng-bootstrap@16.0.0 requires a peer of @angular/forms@^17.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @ng-bootstrap/ng-bootstrap@16.0.0 requires a peer of @angular/common@^17.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @ng-bootstrap/ng-bootstrap@16.0.0 requires a peer of @angular/localize@^17.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN ngx-mat-timepicker@17.1.0 requires a peer of @angular/core@^17.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN ngx-mat-timepicker@17.1.0 requires a peer of @angular/forms@^17.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN ngx-mat-timepicker@17.1.0 requires a peer of @angular/common@^17.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN ngx-mat-timepicker@17.1.0 requires a peer of @angular/compiler@^17.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN ngx-mat-timepicker@17.1.0 requires a peer of @angular/animations@^17.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN ngx-mat-timepicker@17.1.0 requires a peer of @angular/platform-browser@^17.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN ngx-cookie-service@17.1.0 requires a peer of @angular/common@^17.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN ngx-cookie-service@17.1.0 requires a peer of @angular/core@^17.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN webpack-dev-middleware@7.4.2 requires a peer of webpack@^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN vite@4.5.5 requires a peer of less@* but none is installed. You must install peer dependencies yourself.
npm WARN vite@4.5.5 requires a peer of sass@* but none is installed. You must install peer dependencies yourself.
npm WARN vite@4.5.5 requires a peer of stylus@* but none is installed. You must install peer dependencies yourself.
npm WARN vite@4.5.5 requires a peer of terser@^5.4.0 but none is installed. You must install peer dependencies yourself.
npm WARN vite@4.5.5 requires a peer of sugarss@* but none is installed. You must install peer dependencies yourself.
npm WARN vite@4.5.5 requires a peer of @types/node@>= 14 but none is installed. You must install peer dependencies yourself.
npm WARN vite@4.5.5 requires a peer of lightningcss@^1.21.0 but none is installed. You must install peer dependencies yourself.
+ lightning-admin@0.0.0
added 129 packages in 23.533s

Solution

  • The issue is the image which is defined right at the top of the yaml.

    image: atlassian/whatever-...
    

    I was using atlassian/default-image:2 which has node v8.9.4.

    replacing that with atlassian/default-image:4, which has node v18.13.0, solved the problem.

    Atlassian's images are listed here:

    https://support.atlassian.com/bitbucket-cloud/docs/use-docker-images-as-build-environments/