I am trying to build a reactjs using vsts (visual studio team services). I have a very simple pipeline outlined below. Everytime I run Build it fails. It fails because it cannot find the node_modules folder. It seems they are being installed at the wrong directory location.
How can I install the node modules at the correct location? It seems to me that I need to CD into the folder after the get source
command but I cannot figure out how to do change directory before the npm install
command is ran.
Here is my pipeline:
- get source
- install dependencies
- build
- zip the build
Like this in vsts:
The second step Install Dependencies, which reads the package.json file and installs the node_modules, does not place the node_modules in the correct location, this causes my next step, build, to fail.
I can run this manually
To run this manually using VS Code and git I run the following commands and it works every time. Here are the commands and the output.
Open working folder:
git init
git clone [web url to package here]
ls
d----- 8/30/2018 10: 56 AM CairsWebClient
cd CairsWebClient
npm install
npm start
Runs perfect.
Here are the details of the install command in vsts:
I have tried adding the following to the package.json location field. It always fails. ./CairsWebClient - Fail /CairsWebClient - Fail cannot find C:\CairsWebClient CairsWebClient - Error: ENOENT: no such file or directory, stat 'D:\a\1\s\CairsWebClient'