[英]'tsc' is not recognized as an internal or external command, operable program or batch file. - Windows 7
[英]Windows batch file changes the location for the second command
我想创建一个批处理文件来执行我的 Angular 项目:
setlocal
cd /d %~dp0
cd ui
npm i && npm start
该文件只是转到当前目录,然后转到ui
文件夹。 首先运行npm i
命令,然后运行 nmp nmp start
命令。 问题是第二个命令给了我以下错误:
npm ERR:路径 C.\Windows\System32\package.json
...
Surprisingly the locations is changed to C:\Windows\System32\
and npm start
command can not find a package.json
file there. 我想知道为什么会发生这种情况以及如何预防。 我希望在同一目录中执行第二个命令。
正如@Compo 建议的那样,在最后一行的开头添加一个调用解决了这个问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.