Closed3

Private な GitHub Packages に依存したアプリケーションを Vercel にデプロイする

dqndqn

結論

次のような .npmrc の内容を NPM_RC という名前で Vercel の環境変数に設定する。<my-package><github-personal-access-token> は各々の環境に合わせて書き換える。

@<my-package>:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=<github-personal-access-token>

NPM_RC は特別な環境変数で、Vercel がビルド前に .npmrc として出力してくれる。

dqndqn

記事には次のようなことが書かれていたが、先述のように特定のパッケージだけ registry を指定してやれば npm のトークンを用意する必要はない。

Also note that Vercel Runtimes are installed from the canonical npm registry so registry.npmjs.org must be one of the lines in your .npmrc file:

//registry.npmjs.org/:_authToken=TOKEN_FOR_NPM
//npm.pkg.github.com/:_authToken=TOKEN_FOR_GITHUB
このスクラップは2022/03/17にクローズされました