How to install node_modules only one time for one React JS project?

Viewed 19

As I am implementing release automation of React JS project using Jenkins, it is required to download node_modules for a project only once and update successively. It doesn't mean one node_ modules for all projects. But one-time install for one project.

For example, Let's consider a project LoginReactApp. I have to maintain a workspace like D:/jenkins/workspace/LoginReactApp.

So, I have to check out the source under D:/jenkins/workspace/LoginReactApp/LoginReactApp and based on the package.json file, I need to download it under D:/jenkins/workspace/LoginReactApp/.

After the release process, the LoginReactApp project source will be deleted under D:/jenkins/workspace/LoginReactApp/ and the node_modules folder will not be deleted.

So, next time it is enough to check out only LoginReactApp project source D:/jenkins/workspace/LoginReactApp/ and it refers to already installed node_modules.

I have tried in command prompt below.

D:/jenkins/workspace/LoginReactApp/LoginReactApp>npm install --production --f --prefix D:/jenkins/workspace/LoginReactApp/

Is it right? For next time it behaves differently.

How to install node_modules only one time for one React JS project?

0 Answers
Related