Javascript ReferenceError:未在github操作上定义require
我在github上运行了Javascript ReferenceError:未在github操作上定义require,javascript,node.js,github,Javascript,Node.js,Github,我在github上运行了npm run build,但它显示了ReferenceError:require未定义的错误 github操作的错误消息如下 [webpack-cli] ReferenceError: require is not defined at file:///home/runner/work/sampleProject/sampleProject/webpack.config.js:2:14 - name: Use Node.js ${{ matrix.
npm run build
,但它显示了ReferenceError:require未定义的错误
github操作的错误消息如下
[webpack-cli] ReferenceError: require is not defined
at file:///home/runner/work/sampleProject/sampleProject/webpack.config.js:2:14
- 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
webpack.config.js
包含了这一点
const path = require('path');
github操作的一部分是这样的
[webpack-cli] ReferenceError: require is not defined
at file:///home/runner/work/sampleProject/sampleProject/webpack.config.js:2:14
- 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
github操作使用node.js,因此我认为该操作可以使用require
函数,但无法使用。
你知道吗