Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/38.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript ReferenceError:未在github操作上定义require_Javascript_Node.js_Github - Fatal编程技术网

Javascript ReferenceError:未在github操作上定义require

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.

我在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.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
函数,但无法使用。 你知道吗