Can anyone explain this command?
CMD [ -d "node_modules" ] && npm run start || npm ci && npm run start
2
If a directory named node_modules exists, then run npm run start. Else run npm ci and then npm run start.
node_modules
npm run start
npm ci
The objective is to only run npm ci if node_modules doesn’t exist.
Basically -d tests for directory existence and runs npm run start, otherwise it will run npm ci && npm run start
npm ci && npm run start
Click here to cancel reply.
2
Answers
If a directory named
node_modules
exists, then runnpm run start
. Else runnpm ci
and thennpm run start
.The objective is to only run
npm ci
if node_modules doesn’t exist.Basically -d tests for directory existence and runs
npm run start
, otherwise it will runnpm ci && npm run start