Why do we need both npm install
and npm install base1
in the prestart
section?
If npm install
itself retrieves base1
from Git then why do we need to mention npm install base1
in prestart
?
For one Node.js program I saw the package.json
shown here:
{
"name": "user01",
"version": "1.5.1",
"description": "",
"author": "",
"private": "true",
"main": "app.js",
"scripts": {
"start": "node app.js",
"prestart": "npm install && npm install base1 && npm install base2"
},
"dependencies": {
"ain2": "*",
"body-parser": "^1.15.0",
"express": "^4.13.3",
"uuid": "*",
"request": "^2.69.0",
"traverse": "*",
"base1": "git+ssh://xxxxxxxxxxx/base1.git",
"base2": "git+ssh://xxxxxxxxxx/base2.git"
}
}
The extra commands might do nothing in npm@3 or recent versions of npm@2 where the git remote is fetched every time. They could be a workaround for some previous git issues where code doesn't update to the latest commit on
npm install
(back in v0.12 releases). Specifying the package could force the fetch of the latest version of the code from git, which a plainnpm install
wouldn't do when the package was already installed.To confirm what currently happens, see what the differences are for the git
base1
package.When the code in git has been updated run the two installs in debug without removing the modules
The extra installs are probably not required any more, if this was their purpose.