簡體   English   中英

'eval' 在 windows npm 腳本上未被識別為內部或外部命令、可運行程序或批處理文件

[英]'eval' is not recognized as an internal or external command, operable program or batch file on windows npm script

$ npm run deploy:local

> backend@0.1.0 deploy:local
> eval "`aws-auth-helper ` lerna run deploy:sandbox --stream"

'eval' is not recognized as an internal or external command,
operable program or batch file.

節點版本:

$ node --version
v15.11.0

NPM 版本:

$ npm --version
7.6.0

我正在使用 VSCode Bash 終端。 它一直工作得很好,但后來我開始收到這個錯誤。 bash 端子和 javascript 端子都試過了。

如果我只是在 bash 終端中輸入“eval”,就可以了。 通過 npm 腳本運行時,它不會。

Since you are on a Windows environment, even if the shell you're executing from is bash, npm will likely be executing the run script in the default shell of Windows (PS now, I think?).

如果bash在您的 PATH 變量中(1),您可以嘗試以這種方式修改package.json文件:

{
//... other keys
  "scripts" : {
    //... other keys
    "deploy" : "bash -c \"eval `aws-auth-helper ` lerna run deploy:sandbox --stream\" "
  }
}

(1)或者使用bash.exe的完整路徑

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM