嗨,我有代码管道来部署我的 Angular 应用程序,并且在该应用程序中我使用的是我的私有 github 包。一切都在本地运行等。但是在 codeBuild 上我不知道如何注册到 github 包存储库。
我的构建规范看起来像:
version: 0.2
env:
variables:
S3_BUCKET: "{{s3_bucket_url}}"
BUILD_ENV: "{{BUILD_ENV}}"
BUILD_FOLDER: "dist"
phases:
install:
runtime-versions:
nodejs: 14
pre_build:
commands:
- echo Installing source NPM dependencies...
- npm install
- npm install -g @angular/cli
build:
commands:
- echo Build started on `date` with $BUILD_ENV flag.
- ng build $BUILD_ENV
post_build:
commands:
- echo Build completed on `date`
artifacts:
files:
- '**/*'
base-directory: 'dist*'
如果 npm install 失败,因为404 Not Found - GET https://registry.npmjs.org. 例如,在 github 操作中,我只是简单地定义registry-url: 'https://npm.pkg.github.com'并且那是正确的。
感谢帮助 :)