github actionを実行させると、下記のエラーが出てしまいます。
node.jsで実行が出来ていないようなのですが、actions/setup-node@v2
を行ってnodeを使える状態にしていても同じエラーでした。
もしこのあたり知見のある方いらっしゃいましたら、是非教えて頂ければと思います。
github actionのエラー
[webpack-cli] Failed to load '/home/runner/work/sampleProject/sampleProject/webpack.config.js' config [webpack-cli] ReferenceError: require is not defined at file:///home/runner/work/sampleProject/sampleProject/webpack.config.js:2:14 at ModuleJob.run (internal/modules/esm/module_job.js:152:23) at async Loader.import (internal/modules/esm/loader.js:166:24) at async loadConfig (/home/runner/work/sampleProject/sampleProject/node_modules/webpack-cli/lib/webpack-cli.js:1346:35) at async WebpackCLI.resolveConfig (/home/runner/work/sampleProject/sampleProject/node_modules/webpack-cli/lib/webpack-cli.js:1454:38) at async WebpackCLI.createCompiler (/home/runner/work/sampleProject/sampleProject/node_modules/webpack-cli/lib/webpack-cli.js:1839:22) at async WebpackCLI.buildCommand (/home/runner/work/sampleProject/sampleProject/node_modules/webpack-cli/lib/webpack-cli.js:1954:20) at async Command.<anonymous> (/home/runner/work/sampleProject/sampleProject/node_modules/webpack-cli/lib/webpack-cli.js:735:25) at async Promise.all (index 1) at async Command.<anonymous> (/home/runner/work/sampleProject/sampleProject/node_modules/webpack-cli/lib/webpack-cli.js:1284:13) npm ERR! code ELIFECYCLE npm ERR! errno 2 npm ERR! sampleProject@1.0.0 build: `webpack --mode=production` npm ERR! Exit status 2 npm ERR! npm ERR! Failed at the sampleProject@1.0.0 build script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. npm ERR! A complete log of this run can be found in: npm ERR! /home/runner/.npm/_logs/2021-05-03T15_18_16_352Z-debug.log Error: Process completed with exit code 2.
Github Actionの設定
name: Deploy to Firebase Hosting on PR 'on': pull_request jobs: build_and_preview: runs-on: ubuntu-latest strategy: matrix: os: [ latest ] node: [ latest ] steps: - uses: actions/checkout@v2 - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v2 with: node-version: ${{ matrix.node-version }} - name: setup npm run: | npm install npm run build - uses: FirebaseExtended/action-hosting-deploy@v0 with: repoToken: '${{ secrets.GITHUB_TOKEN }}' firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_SAMPLEPROJECT }}' projectId: sampleProject env: FIREBASE_CLI_PREVIEWS: hostingchannels
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。