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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/bash/16.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 如何运行命令'';git版本解析$REVISION';在nodejs中_Node.js_Git - Fatal编程技术网

Node.js 如何运行命令'';git版本解析$REVISION';在nodejs中

Node.js 如何运行命令'';git版本解析$REVISION';在nodejs中,node.js,git,Node.js,Git,const execSync=require('child_process')。execSync execSync('git rev parse$REVISION:./index.js')) 错误信息: fatal: Invalid object name '$REVISION'. child_process.js:660 throw err; ^ Error: Command failed: git rev-parse $REVISION:./index.js fatal: I

const execSync=require('child_process')。execSync execSync('git rev parse$REVISION:./index.js'))

错误信息:

fatal: Invalid object name '$REVISION'. child_process.js:660
   throw err;
     ^
Error: Command failed: git rev-parse $REVISION:./index.js fatal:
Invalid object name '$REVISION'.
欢迎光临。请采取的网站,阅读和如何创建一个。然后回到你的问题并重新表述它(最好使用代码示例、提供的输入和预期的输出),以便得到一个(有用的)答案。在发布问题之前,请访问该网站并确保没有回答类似的问题。使用问题编辑器工具栏中的
{}
按钮可以很好地格式化代码(或者在只包含
`
的两行之间编写代码)。
const hash = execSync('git rev-parse --short $REVISION:./index.js', {
  cwd: __dirname,
  shell: 'C:\\Program Files\\Git\\bin\\sh.exe',
})