Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/39.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 在节点脚本中按顺序运行一组命令_Node.js_Yarnpkg_Yarnpkg V2_Yarn V2 - Fatal编程技术网

Node.js 在节点脚本中按顺序运行一组命令

Node.js 在节点脚本中按顺序运行一组命令,node.js,yarnpkg,yarnpkg-v2,yarn-v2,Node.js,Yarnpkg,Yarnpkg V2,Yarn V2,我想按顺序使用Thread命令,并在中间步骤中在节点脚本中运行它,然后根据需要将其与js混合使用。比如说 yarn audit > out.json //some file reading, processing, and storage for(i = 0; i < libs.length; i++) { yarn add lib1@v1.1.1 //need to run this in a loop //print the console output a

我想按顺序使用Thread命令,并在中间步骤中在节点脚本中运行它,然后根据需要将其与js混合使用。比如说

yarn audit > out.json

//some file reading, processing, and storage

for(i = 0; i < libs.length; i++) {

    yarn add lib1@v1.1.1 //need to run this in a loop
    //print the console output as this is being done
}
warn audit>out.json
//一些文件读取、处理和存储
对于(i=0;i

在node js或可用于node项目的任何其他脚本中是否可能出现上述情况?

我尝试过这一建议,但效果不好,很快就会退出或出现错误。您可以使用
子进程执行命令