Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/40.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
Node.js npm启动后Github操作不起作用_Node.js_Continuous Integration_Next.js_Cypress_Github Actions - Fatal编程技术网

Node.js npm启动后Github操作不起作用

Node.js npm启动后Github操作不起作用,node.js,continuous-integration,next.js,cypress,github-actions,Node.js,Continuous Integration,Next.js,Cypress,Github Actions,我有一个非常简单的配置,以便在Nextjs应用程序中使用Github操作使用Cypress运行e2e测试。当它到达npm start命令时,尽管它似乎可以工作,因为它给出了正确的输出:>Ready onhttp://localhost:3000,该步骤将保持挂起状态,而不会前进到下一步 有没有关于如何解决这个问题的建议 以下github操作配置(.github/workflows/nodejs.yml): 使用控制操作员&对我有效。尝试以下方法 - name: npm install,

我有一个非常简单的配置,以便在Nextjs应用程序中使用Github操作使用Cypress运行e2e测试。当它到达
npm start
命令时,尽管它似乎可以工作,因为它给出了正确的输出:
>Ready onhttp://localhost:3000
,该步骤将保持挂起状态,而不会前进到下一步

有没有关于如何解决这个问题的建议

以下github操作配置(
.github/workflows/nodejs.yml
):


使用控制操作员
&
对我有效。尝试以下方法

    - name: npm install, build, and test
      run: |
        npm ci
        npm run build --if-present
        npm start & npx wait-on http://localhost:3000
      env:
        CI: true

如果命令被控制运算符&终止,则shell将在中执行该命令 子shell中的背景。shell不会等待命令完成,而 返回状态为0。这些命令称为异步命令。命令分离 通过;是按顺序执行的;shell依次等待每个命令终止。 返回状态是最后执行的命令的退出状态


我想知道问题是否是npx等待http://localhost:3000。你试过npx等一下吗http://127.0.0.1:3000?我想我以前经历过
localhost
不起作用的情况。
    - name: npm install, build, and test
      run: |
        npm ci
        npm run build --if-present
        npm start & npx wait-on http://localhost:3000
      env:
        CI: true