以下命令在我的本地开发环境中执行得很好:
npm install -g
npm install -g @angular/cli
但是当我尝试在 Bitbucket 管道中执行此操作时,会发生以下情况:
- step:
name: Web Admin Portal Deployment
caches:
- node
script:
- cd Admin
- npm install -g
- npm install -g @angular/cli
- ng build --configuration staging
+ 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
事实是,虽然它没有破坏脚本,但第一个 npm install -g 并没有像在我的本地工作站上那样干净地运行。当我展开此部分时,这是详细信息。
知道我需要做什么才能让它在 Bitbucket 管道中干净地运行吗?谢谢!
编辑:这可能是一个线索。我在那里输入了一个命令来输出节点的版本:
node -v
v8.9.4
哎呀!那是相当老了!在我的工作站上,我运行 v20.15.1
如何在管道中安装更新版本的 Node?
+ npm install -g
npm WARN lifecycle [email protected]~postinstall: cannot run in wd %s %s (wd=%s) [email protected] 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 [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @esbuild/[email protected] (../../../../../../opt/atlassian/pipelines/agent/build/Admin/node_modules/esbuild/node_modules/@esbuild/android-arm):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @esbuild/[email protected]: wanted {"os":"android","arch":"arm"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @esbuild/[email protected] (../../../../../../opt/atlassian/pipelines/agent/build/Admin/node_modules/esbuild/node_modules/@esbuild/android-x64):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @esbuild/[email protected]: wanted {"os":"android","arch":"x64"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @esbuild/[email protected] (../../../../../../opt/atlassian/pipelines/agent/build/Admin/node_modules/esbuild/node_modules/@esbuild/sunos-x64):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @esbuild/[email protected]: wanted {"os":"sunos","arch":"x64"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @esbuild/[email protected] (../../../../../../opt/atlassian/pipelines/agent/build/Admin/node_modules/esbuild/node_modules/@esbuild/linux-arm):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @esbuild/[email protected]: wanted {"os":"linux","arch":"arm"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @esbuild/[email protected] (../../../../../../opt/atlassian/pipelines/agent/build/Admin/node_modules/esbuild/node_modules/@esbuild/win32-ia32):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @esbuild/[email protected]: wanted {"os":"win32","arch":"ia32"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @esbuild/[email protected] (../../../../../../opt/atlassian/pipelines/agent/build/Admin/node_modules/esbuild/node_modules/@esbuild/netbsd-x64):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @esbuild/[email protected]: wanted {"os":"netbsd","arch":"x64"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @esbuild/[email protected] (../../../../../../opt/atlassian/pipelines/agent/build/Admin/node_modules/esbuild/node_modules/@esbuild/linux-ia32):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @esbuild/[email protected]: wanted {"os":"linux","arch":"ia32"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @esbuild/[email protected] (../../../../../../opt/atlassian/pipelines/agent/build/Admin/node_modules/esbuild/node_modules/@esbuild/darwin-x64):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @esbuild/[email protected]: wanted {"os":"darwin","arch":"x64"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @esbuild/[email protected] (../../../../../../opt/atlassian/pipelines/agent/build/Admin/node_modules/esbuild/node_modules/@esbuild/win32-x64):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @esbuild/[email protected]: wanted {"os":"win32","arch":"x64"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @esbuild/[email protected] (../../../../../../opt/atlassian/pipelines/agent/build/Admin/node_modules/esbuild/node_modules/@esbuild/freebsd-arm64):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @esbuild/[email protected]: wanted {"os":"freebsd","arch":"arm64"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @esbuild/[email protected] (../../../../../../opt/atlassian/pipelines/agent/build/Admin/node_modules/esbuild/node_modules/@esbuild/darwin-arm64):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @esbuild/[email protected]: wanted {"os":"darwin","arch":"arm64"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @esbuild/[email protected] (../../../../../../opt/atlassian/pipelines/agent/build/Admin/node_modules/esbuild/node_modules/@esbuild/openbsd-x64):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @esbuild/[email protected]: wanted {"os":"openbsd","arch":"x64"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @esbuild/[email protected] (../../../../../../opt/atlassian/pipelines/agent/build/Admin/node_modules/esbuild/node_modules/@esbuild/linux-s390x):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @esbuild/[email protected]: wanted {"os":"linux","arch":"s390x"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @esbuild/[email protected] (../../../../../../opt/atlassian/pipelines/agent/build/Admin/node_modules/esbuild/node_modules/@esbuild/linux-loong64):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @esbuild/[email protected]: wanted {"os":"linux","arch":"loong64"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @esbuild/[email protected] (../../../../../../opt/atlassian/pipelines/agent/build/Admin/node_modules/esbuild/node_modules/@esbuild/linux-ppc64):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @esbuild/[email protected]: wanted {"os":"linux","arch":"ppc64"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @esbuild/[email protected] (../../../../../../opt/atlassian/pipelines/agent/build/Admin/node_modules/esbuild/node_modules/@esbuild/android-arm64):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @esbuild/[email protected]: wanted {"os":"android","arch":"arm64"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @esbuild/[email protected] (../../../../../../opt/atlassian/pipelines/agent/build/Admin/node_modules/esbuild/node_modules/@esbuild/win32-arm64):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @esbuild/[email protected]: wanted {"os":"win32","arch":"arm64"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @esbuild/[email protected] (../../../../../../opt/atlassian/pipelines/agent/build/Admin/node_modules/esbuild/node_modules/@esbuild/linux-arm64):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @esbuild/[email protected]: wanted {"os":"linux","arch":"arm64"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @esbuild/[email protected] (../../../../../../opt/atlassian/pipelines/agent/build/Admin/node_modules/esbuild/node_modules/@esbuild/freebsd-x64):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @esbuild/[email protected]: wanted {"os":"freebsd","arch":"x64"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @esbuild/[email protected] (../../../../../../opt/atlassian/pipelines/agent/build/Admin/node_modules/esbuild/node_modules/@esbuild/linux-mips64el):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @esbuild/[email protected]: wanted {"os":"linux","arch":"mips64el"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @esbuild/[email protected] (../../../../../../opt/atlassian/pipelines/agent/build/Admin/node_modules/esbuild/node_modules/@esbuild/linux-riscv64):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @esbuild/[email protected]: wanted {"os":"linux","arch":"riscv64"} (current: {"os":"linux","arch":"x64"})
npm WARN @fortawesome/[email protected] requires a peer of @angular/core@^17.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @ng-bootstrap/[email protected] requires a peer of @angular/core@^17.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @ng-bootstrap/[email protected] requires a peer of @angular/forms@^17.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @ng-bootstrap/[email protected] requires a peer of @angular/common@^17.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @ng-bootstrap/[email protected] requires a peer of @angular/localize@^17.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of @angular/core@^17.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of @angular/forms@^17.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of @angular/common@^17.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of @angular/compiler@^17.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of @angular/animations@^17.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of @angular/platform-browser@^17.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of @angular/common@^17.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of @angular/core@^17.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of webpack@^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of less@* but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of sass@* but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of stylus@* but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of terser@^5.4.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of sugarss@* but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of @types/node@>= 14 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of lightningcss@^1.21.0 but none is installed. You must install peer dependencies yourself.
+ [email protected]
added 129 packages in 23.533s
问题是在 yaml 顶部定义的图像。
image: atlassian/whatever-...
我使用的是 atlassian/default-image:2 ,它有节点 v8.9.4。
将其替换为具有节点 v18.13.0 的 atlassian/default-image:4,解决了问题。
Atlassian 的图像列于此处:
https://support.atlassian.com/bitbucket-cloud/docs/use-docker-images-as-build-environments/