[英]antlr4-tool fails in Win10 with: Error: Command failed: which java
Running in Win10, in an attempt to create a parser in Node.JS, I installed ANTLR4 tool: 在Win10中运行,尝试在Node.JS中创建解析器,我安装了ANTLR4工具:
npm install --save-dev antlr4-tool
Ran: 冉:
c:/prj/parser/node_modules/.bin/antlr4-tool.cmd -o parser grammar/Lang.g4
But received: 但收到:
Compiling grammar/Lang.g4...
'which' is not recognized as an internal or external command,
operable program or batch file.
child_process.js:677
throw err;
^
Error: Command failed: which java
'which' is not recognized as an internal or external command,
operable program or batch file.
at checkExecSyncError (child_process.js:637:11)
at Object.execSync (child_process.js:674:13)
at c:\prj\parser\node_modules\antlr4-tool\dist\antlr-core\antlr-compiler.js:98:19
at chdir (c:\prj\parser\node_modules\chdir\index.js:6:13)
at AntlrCompiler.compileJavaScript (c:\prj\parser\node_modules\antlr4-tool\dist\antlr-core\antlr-compiler.js:97:9)
at AntlrCompiler.compileTypeScript (c:\prj\parser\node_modules\antlr4-tool\dist\antlr-core\antlr-compiler.js:62:38)
at c:\prj\parser\node_modules\antlr4-tool\dist\antlr-core\index.js:40:78
at c:\prj\parser\node_modules\antlr4-tool\dist\antlr-core\index.js:17:23
at arrayEach (c:\prj\parser\node_modules\lodash\lodash.js:516:11)
at Function.forEach (c:\prj\parser\node_modules\lodash\lodash.js:9344:14)
I have Java install, and I can see its location when running: 我有Java安装,我可以在运行时看到它的位置:
where java
But since I'm in Windows, I don't understand why the command is which
and not where
... 但是因为我在Windows中,我不明白为什么命令是which
而不是where
......
To whomever gets here, it's a bug, apprently stemming from the difference between Linux and Windows ( which
command in Linux is where
in Windows). 给谁就给谁送过来,这是一个错误,从Linux和Windows(之间的差异所产生apprently which
在Linux命令是where
在Windows)。
To W/A it, only if you work in Windows , change the file: 要W / A, 只有在Windows中工作时, 才能更改文件:
.../node_modules/antlr4-tool/dist/antlr-core/antlr-compiler.js
, line #98, from: .../node_modules/antlr4-tool/dist/antlr-core/antlr-compiler.js
,第98行,来自:
child.execSync('which java');
to: 至:
child.execSync('where java');
See https://github.com/mcchatman8009/antlr4-tool/issues/21 请参阅https://github.com/mcchatman8009/antlr4-tool/issues/21
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.