bat file - change directory and npm install in that directory, then switch again

Aric Peters

So I have a large number of services I'm running locally for my application, and I need a nice convenient way to first install all of their dependencies without going into the individual folders in one terminal, and second keep them up to date easier. I'm using node/npm and its not working. Here is an example of how it looks

start cd ./Service1 && npm install
start cd ./Service2 && npm install
start cd ./Service3 && npm install

and it keeps going and going. When I run the bat file, it will open a cmd prompt for each one as it should, and it changes directories just fine, but it switches back to the directory all of the services are housed in and then runs npm install. At least from what I can tell, that is what's happening. How can I change to Service1 and run npm install in it's own cmd prompt, then open another cmd prompt and do the same thing and so on?

Squashman

In your code the START command starts a separate process and does a change directory. That process is its own separate environment and then closes that environment.

I think what you are attempting to do is see if the folder exists and if it does then run npm install.

So a better option would be.

IF EXIST "Service1" START "" /D Service1 call npm install

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

使用npm install命令创建.bat文件

.NET Directory.Move()与File.Move()

Copy a specific percentage of each file in a directory to a new file

Print line for word found in file in directory

'No such file or directory' when I am trying to format Logical Volume

Change the default directory of one specific program without changing its path

bourne shell,如果[-e $ directory / file。$ suffix]

Why grep on remote system says file or directory not available

对于无效的输入,GetFileAttributes返回FILE_ATTRIBUTE_DIRECTORY

Python内的Django File-Directory

为什么“ npm install <directory>”会忽略devDependencies?

如何解决 rsync 中的错误“execv: No such file or directory”?

npm install 与 npm install <library>

为什么 FILE_ATTRIBUTE_DIRECTORY 是 16,而不是 8?

`gcc: error: 0": No such file or directory` 错误的本质是什么?

Xcode 错误 Alamofire.framework: No such file or directory

我从 Buildozer 创建,终端说 bash: no such file or directory

Tensorflow 导入错误:libcudnn.so.5 No such file or directory

Wifi Jammer SH1106Wire.h: No such file or directory

Confluent 本地启动给出 config.json: No such file or directory

尝试从 API 获取 JSON 数据时出现 No such file or directory 错误?

npm install - 在 spawn sass.bat ENOENT 中出错

Qt: How to create a directory in project file?

使用 Kubernetes cronjob 和 dockerfile 出现 No such file or directory 错误

如何解决 mv cannot stat No such file or directory 错误

错误信息是 Errno 2 No such file or directory

使用 sed 抛出 No such file or directory

新 Mac OS Monterey 上的“env: php: No such file or directory”

How to create a file from directory structure