Question: I have a backend and frontend parts of the project in single root folder:

```
./app/ - backend files and folders
./app/forntend/ - front end files and folders

```

in my app folder I have package.json with scripts and backend dependencies, installation script here is: `"install": "npm i && cd ./frontend && npm i"`, I also have package.json in frontend with its own denendencies
when I run installation script it enters into infinite loop of installs, which I have to terminate manually.
Is there way to have a single installation script in `package.json`?

Answer: 
You can solve this problem by using **concurrently** npm module.
./app/ - backend files and folders
./app/forntend/ - front end files and folders

With concurrently installed in your root folder i.e. ./app/->backend, you can run multiple custom npm scripts. For example: you can create 2 separate scripts that are installing the dependencies (client-dependencies and server-dependencies) and then create install-all-deps script that will run both scripts one after another and install all deps in both directories.

```
{
    "scripts": {
    "server-dependencies": "npm install",
    "client-dependencies": "npm install --prefix forntend",
    "install-all-deps": "concurrently \"npm run server-dependencies\" \"npm run client-dependencies\""
    }
}

```

Link for Concurrently :- <https://www.npmjs.com/package/concurrently>
Hope this helps.
If you are installing concurrently part of server app then you will get an error concurrently is not installed. For that we have install concurrently first in following way

```
"scripts": {
    "install-server": "npm install",
    "install-client": "npm install --prefix forntend",
    "install": "npm install concurrently --save & concurrently \"npm run install-server\" \"npm run install-client\"",
    "start": "concurrently \"nodemon node_server/server.js\" \"npm run build\"",
    "test": "echo \"Error: no test specified\" && exit 1"
  },

```

where

Use `&&` (double ampersand) for sequential execution.

Use `&` (single ampersand) for parallel execution.