2

Locally the project I have runs fine and the npm install command completes successfully. I am using Node 11.5 and recently installed file-loader with no issues.

However when I pushed the build to VSTS and it ran the 'npm install' command I noticed in the log output that for some reason its using Node 12.13 whereas up until this point it had been Node 11.5. The command did not finish successfully and failed with the following:

gyp ERR! build error 
gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual 
Studio\2017\Enterprise\MSBuild\15.0\Bin\MSBuild.exe` failed with exit code: 
1
gyp ERR! stack     at ChildProcess.onExit 
(D:\a\1\s\Navico.Global\Navico.Global.Web\node_modules\node- 
gyp\lib\build.js:262:23)
   gyp ERR! stack     at ChildProcess.emit (events.js:210:5)
gyp ERR! stack     at Process.ChildProcess._handle.onexit 
 (internal/child_process.js:272:12)
gyp ERR! System Windows_NT 10.0.14393
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" 
"D:\\a\\1\\s\\Navico.Global\\Navico.Global.Web\\node_modules\\node- 
gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "-- 
libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
 gyp ERR! cwd D:\a\1\s\Navico.Global\Navico.Global.Web\node_modules\node- 
sass
gyp ERR! node -v v12.13.0
gyp ERR! node-gyp -v v3.8.0
 gyp ERR! not ok 
Build failed with error code: 1
npm verb lifecycle [email protected]~postinstall: unsafe-perm in lifecycle true

What I have tried so far:

  • Commit package-lock.json as did not commit it at first.
  • Updated Node-sass from 4.9 to 4.10.
  • Added file-loader to dependencies in package.json.

I am guessing something recently added (file-loader) is causing something to tell the build agent on VSTS to use Node 12.13 instead of 11.5 but not sure where to look. I am new to VSTS I have used TeamCity before and if we ever had any issues with build agents we could just remote onto the agent and fix the issue but not sure how/if that is possible in VSTS.

Any help will be greatly appreciated!

Thanks, James

3 Answers 3

2

If you want to sure about the version of node that is being used during your build add the 'Node.js tool Installer' task. in the task you can define the exact version of node that will be used. this will make sure that your build will run more predictably in the future regardless of changes to the default version used by the Microsoft agents.

enter image description here

Sign up to request clarification or add additional context in comments.

1 Comment

You are correct! I was just about to come on here an put the answer in myself but see you have already done it! I found this blog post literally 5 mins after posting this question mariusschulz.com/blog/…
1

I was having a similar problem. I tried the above answer and was still having an issue. Once I changed the solution in VSTS to build with VS2017 instead of "latest" my build started working again. enter image description here

Looks like Microsoft recently upgraded tooling on their hosted agent.

1 Comment

Mine was/is building with VS2017. When searching for the fix I did come across a few posts where people had the same issue as you with running VS2019. +1 for the MS upgrade note I did have a feeling something must of changed recently as pretty sure the npm package I added did not cause the sudden node version change on the VSTS build agent
0

I deleted package-lock and pushed changes and the build works as expected

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.