Azure Devops VSTS build agent using different version of Node - node.js

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 node-sass#4.10.0~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

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.

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.
Looks like Microsoft recently upgraded tooling on their hosted agent.

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

Related

Why doesn't npm start or npm install work?

I'm just getting started with react/firebase/expo so I'm really baffled on this one.
I'm not even sure how to explain what's happening, but basically if I try to run "npm install", I get the following output on the console:
E:\Visual Studio\MSBuild\Microsoft\VC\v160\Microsoft.Cpp.WindowsSDK.targets(46,5): error MSB8036: The Windows SDK version 10.0.18362.0 was not found. Install the required version of Windows SDK or change the SDK version in the project p
roperty pages or by right-clicking the solution and selecting "Retarget solution". [C:\Users\User\source\repos\projeto\projeto\Moosic\node_modules\grpc\build\z.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `E:\Visual Studio\MSBuild\Current\Bin\MSBuild.exe` failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:194:23)
gyp ERR! stack at ChildProcess.emit (events.js:315:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
gyp ERR! System Windows_NT 10.0.18363
Whole output is here: https://pastebin.com/85kSH3qt
If I run npm start, EXPO tells me
ERROR warn Package firebase has been ignored because it contains invalid configuration. Reason: Cannot find module 'firebase\package.json'
Require stack:
C:\Users\User\source\repos\projeto\projeto\Moosic\node_modules\react-native\node_modules#react-native-community\cli\build\tools\config\resolveNodeModuleDir.js
C:\Users\User\source\repos\projeto\projeto\Moosic\node_modules\react-native\node_modules#react-native-community\cli\build\tools\releaseChecker\index.js
C:\Users\User\source\repos\projeto\projeto\Moosic\node_modules\react-native\node_modules#react-native-community\cli\build\commands\start\runServer.js
C:\Users\User\source\repos\projeto\projeto\Moosic\node_modules\react-native\node_modules#react-native-community\cli\build\commands\start\start.js
C:\Users\User\source\repos\projeto\projeto\Moosic\node_modules\react-native\node_modules#react-native-community\cli\build\commands\index.js
C:\Users\User\source\repos\projeto\projeto\Moosic\node_modules\react-native\node_modules#react-native-community\cli\build\index.js
C:\Users\User\source\repos\projeto\projeto\Moosic\node_modules\react-native\local-cli\cli.js
I really have no clue what's happening. I'm trying to work on a shared repo and everyone else is managing to work just fine. I don't know if this is from a single cause, two different causes, or what is happening. Any help is appreciated, as I've been fighting this problem for the last day with no success.

Error running npm install, returns This is a bug in `node-gyp`

I am new to Angular and Node. I am trying to execute an project created using Angular, Neo4j.
At first, I tried to run it as it is. However, i am givem the following error after opening the browser:
NullInjectorError: StaticInjectorError(AppModule)[RouterScroller -> >ViewportScroller]:
StaticInjectorError(Platform: core)[RouterScroller -> ViewportScroller]:
NullInjectorError: No provider for ViewportScroller!
ERROR Error: Uncaught (in promise): Neo4jError: WebSocket connection failure. Due to security constraints in your web browser, the reason for the failure is not available to this Neo4j Driver. Please use your browsers development console to determine the root cause of the failure. Common reasons include the database being unavailable, using the wrong connection URL or temporary network problems. If you have enabled encryption, ensure your browser is configured to trust the certificate Neo4j is configured to use. WebSocket readyState is: 3
Neo4jError: WebSocket connection failure. Due to security constraints in your web browser, the reason for the failure is not available to this Neo4j Driver. Please use your browsers development console to determine the root cause of the failure. Common reasons include the database being unavailable, using the wrong connection URL or temporary network problems. If you have enabled encryption, ensure your browser is configured to trust the certificate Neo4j is configured to use. WebSocket readyState is: 3
Then, I tried an clean install following this process:
Delete the node_modules from project;
Run npm install --global windows-build-tools
Run npm install
Then i am given this error:
gyp ERR! UNCAUGHT EXCEPTION
gyp ERR! stack Error: spawn C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\15.0\Bin\MSBuild.exe ENOENT
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:269:19)
gyp ERR! stack at onErrorNT (internal/child_process.js:465:16)
gyp ERR! stack at processTicksAndRejections (internal/process/task_queues.js:80:21)
gyp ERR! System Windows_NT 10.0.19041
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\USER_NAME\\PROJECT\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd C:\Users\USER_NAME\PROJECT\node_modules\node-sass
gyp ERR! node -v v14.15.1
gyp ERR! node-gyp -v v3.8.0
gyp ERR! This is a bug in `node-gyp`.
gyp ERR! Try to update node-gyp and file an Issue if it does not help:
gyp ERR! <https://github.com/nodejs/node-gyp/issues>
Sorry for the wall of text. Any suggestions to solve this problem?
Edit:
I've also tried the following:
Rebuilding the node-gyp bindings by running node-gyp rebuild, however that returns the following error:
binding.gyp not found while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! System Windows_NT 10.0.19041
gyp ERR! node -v v14.15.1 gyp ERR! node-gyp -v v7.1.2
I can confirm that node-gyp is installed globally because I ran: npm install -g node-gyp
I tried the gyp rebuild using python 2.7.18 to no avail. Still returning the same error.
Edit 2:
I no longer have access to the project. So I cannot test any new solutions pointed.
Regardless, Thank you guys for the help.
This is a known canvas issue, probably caused by missing native libs.
Try this see if it helps:
sudo npm uninstall -g node-gyp
sudo npm install -g node-gyp
brew install pkg-config cairo libpng jpeg giflib
npm i canvas
For me this was solved by using Node Version 14
tested with docker first docker pull node:14.10.0

Receiving Fatal Error c1083, Cannot open include file stddef.h while building node-gyp in Aurelia Project

I am been facing this problem for weeks now, with no hope of being solved. I am new to Aurelia JavaScript Framework and I am getting grips around the skeleton project hosted on github.
I have successfully installed nodejs, npm and jspm. As part of the requirements I am supposed to run:
npm install
The code runs well but hits a block with the error below
C:\Users\baba\.node-gyp\4.4.5\include\node\v8.h(18): fatal error C1083: Cannot open include file: 'stddef.h': No such file or directory [E:\fwb\node_modules\u
tf-8-validate\build\validation.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Users\baba\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\build.js:276:23)
gyp ERR! stack at emitTwo (events.js:87:13)
gyp ERR! stack at ChildProcess.emit (events.js:172:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Windows_NT 10.0.10586
gyp ERR! command "C:\\nodejs\\node.exe" "C:\\Users\\baba\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd E:\fwb\node_modules\utf-8-validate
gyp ERR! node -v v4.4.5
gyp ERR! node-gyp -v v3.3.1
gyp ERR! not ok
I don't know what I am missing or doing wrong. I would appreciate any help out there to get this running without any error or to put me in a step into the right direction to solve this.
Thank you.
This usually happens because you do not have the necessary build tools on your computer to build the package.
On Unix make sure you have:
python (v2.7 recommended, v3.x.x is not supported)
make
A proper C/C++ compiler toolchain, like GCC
On Mac OS X:
Xcode
You also need to install the Command Line Tools via Xcode. You can find this under the menu Xcode -> Preferences -> Downloads
This step will install gcc and the related toolchain containing make
On Windows:
Visual C++ Build Environment:
Option 1: Install Visual C++ Build Tools using the Default Install option.
Option 2: Install Visual Studio 2015 (or modify an existing installation) and select Common Tools for Visual C++ during setup. This also works with the free Community and Express for Desktop editions.

Getting started with Hubot

I just pulled hubot down from github. I ran npm install from \d\projects\hubot and got pounded with errors. The first error may be causing the rest:
d:\projects\hubot\node_modules\hubot-hipchat\node_modules\node-xmpp\node_modules\node-xmpp-core\node_modules\node-stringprep>node
"d:\Program Files\nodejs\node_modules\npm\bin\node-gyp-> bin\....\node_modules\node-gyp\bin\node-gyp.js"
rebuild gyp ERR! configure error gyp ERR! stack Error: Command failed:
gyp ERR! stack at ChildProcess.exithandler
(child_process.js:647:15) gyp ERR! stack at ChildProcess.emit
(events.js:98:17) gyp ERR! stack at maybeClose
(child_process.js:755:16) gyp ERR! stack at Socket.
(child_process.js:968:11) gyp ERR! stack at Socket.emit
(events.js:95:17) gyp ERR! stack at Pipe.close (net.js:465:12) gyp
ERR! System Windows_NT 6.1.7601 gyp ERR! command "node" "d:\Program
Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js"
"rebuild" gyp ERR! cwd
d:\projects\hubot\node_modules\hubot-hipchat\node_modules\node-xmpp\node_modules\node-xmpp-core\node_modules\node-stringprep
gyp ERR! node -v v0.10.29 gyp ERR! node-gyp -v v0.13.1 gyp ERR! not ok
The first line is pointing to a folder that does not exist on my machine:
d:\projects\hubot\node_modules\hubot-hipchat\node_modules\node-xmpp\node_modules\node-xmpp-core
node-xmpp-core does not exist. I tried installing node-xmpp-client and node-xmpp-sever and once again...tons of errors.
Any idea how I can get to the bottom of this mess?
Turns out I started with the wrong command.
Mac Setup
After pulling down the repo, the right command to start with is:
sudo npm install -g yo generator-hubot
Other stuff you need:
node.js
npm
Coffeescript : sudo npm install -g coffee-script
Redis
This is where things get tricky.
mkdir myhubot
cd myhubot
yo hubot --owner="Bot Wrangler " --name="Hubot" --description="Delightfully aware robutt" --adapter=campfire --defaults
(yo hubot command installs hubot!)
Now switch back to the root directory \wherever\hubot
npm install (install all the other bits hubot also needs)
switch back to the created directory \wherever\hubot\myhubot
Execute hubot :- bin/hubot (installs npm dependencies, loads scripts, launches hubot)
This will put you at a prompt and there will be a bunch of garbage on the screen. Hit <enter>. Now you get the correct prompt...
Hubot> and you can type "hubot help" to test him out.
If hubot does not respond to commands check to make sure you ran bin/hubot from the directory you created \wherever\hubot\myhubot. You can run bin/hubot from the root, but the prompt won't respond to commands.
Full instructions for setup were found on github.
Windows Setup
Basically the same thing. Don't use sudo before any of the commands listed above. You also need two additional packages before Hubot will run. I recommend installing these first:
Install Python 3.2: https://www.python.org/download/releases/3.2/
Install LMXL : https://pypi.python.org/pypi/lxml/3.4.2 (the one related to Python 3.2)
Write some scripts to make him do interesting things.
\wherever\hubot\myhubot\scripts\example.coffee is a good place to start

NPM install error - node-gyp

Trying to install xml-stream package but it keeps failing building dependencies. It seems to require vc2010(vcbuild.exe) but i installed the .Net Framework 2.0 SDK which has the vcbuild file and I'm getting the following error while installing xml-stream:
> node-expat#2.0.0 install G:\Pessoal\node\bugzilla\node_modules\xml-stream\node
_modules\node-expat
> node-gyp rebuild
G:\Pessoal\node\bugzilla\node_modules\xml-stream\node_modules\node-expat>node "D
:\Bin\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\
node-gyp.js" rebuild
Building the projects in this solution one at a time. To enable parallel build,
please add the "/m" switch.
The following error has occurred during XML parsing:
File: G:\Pessoal\node\bugzilla\node_modules\xml-stream\node_modules\node-expa
t\build\deps\libexpat\expat.vcproj
Line: 1
Column: 4916
VCBUILD : error Message: [G:\Pessoal\node\bugzilla\node_modules\xml-stream\nod
e_modules\node-expat\build\binding.sln]
Erro de sistema: -2147154687.
The file 'G:\Pessoal\node\bugzilla\node_modules\xml-stream\node_modules\node-
expat\build\deps\libexpat\expat.vcproj' has failed to load.
gyp ERR! build error
gyp ERR! stack Error: `C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe
` failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (D:\Bin\nodejs\node_modules\npm\node_m
odules\node-gyp\lib\build.js:267:23)
gyp ERR! stack at ChildProcess.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:810:
12)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "node" "D:\\Bin\\nodejs\\node_modules\\npm\\node_modules\\node-
gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd G:\Pessoal\node\bugzilla\node_modules\xml-stream\node_modules\node-
expat
gyp ERR! node -v v0.10.30
gyp ERR! node-gyp -v v0.13.1
gyp ERR! not ok
I believe this is happening because xml-stream depends on node-expat which depends on node-gyp which on windows will require you to either install VS2007 or in some other way install the correct SDK required by node-gyp.
In my case I did not wish to jump through those hoops and found it easier to simply use sax to write a very simple XML parser with no dependency on node-gyp.
I placed it on NPM: https://www.npmjs.com/package/no-gyp-xml-stream
Or just run: npm install no-gyp-xml-stream
It's still a work in progress but it works it's easy to use and it will allow you to read large XML files over a stream returning child elements via a call back. And it's only dependency is sax which will not require you to install anything.

Resources