Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Global NodeJs and TeamCity #8

Open
billrawlinson opened this issue Feb 13, 2015 · 3 comments
Open

Global NodeJs and TeamCity #8

billrawlinson opened this issue Feb 13, 2015 · 3 comments

Comments

@billrawlinson
Copy link

I figure I am just doing something wrong but.. maybe not.

I have an windows 2012 server VM running in Azure cloud with TeamCity. When TeamCity runs the build the MsBuild.NodeTools works fine if I provide the local info for Node.

However, it is really slow becuase of the downloading of various node modules on each build.

So I installed Node globally on the VM at c:\nodejs then added a system environment variable of NODJS which points to c:\nodejs AND it is on the system PATH variable.

Yet I get the error: Global NodeJS installation not found. Please set the 'NODEJS' environment variable for a global installation or set the 'LocalNodePath' property in your project file for a local installation.

I am hoping that with the global node install that it will cache the modules locally so when each build needs them it will just be copying them on the filesystem and not have to re-download them each time (which takes roughly 3.5 minutes).

On my personal machine the build works fine without specifying a local node path and without having a SYSTEM environment variable of NODEJS.

Any help would be appreciated.

EDIT: I've restarted the TeamCity service (just to be on the safe side) but that didn't seem to help.

@billrawlinson billrawlinson changed the title Global NodeJs Global NodeJs and TeamCity Feb 13, 2015
@billrawlinson
Copy link
Author

It appears that restarting the Build Agents worked and now Node is running from the global install.

I'm adding some more info for anyone else who tries this:

  1. Node still won't really install things right away because of some path issues when TeamCity is running as "System" you need to update the global config information for node modules. I used these steps: http://stackoverflow.com/a/26894197/7329

Plus you have to update the PREFIX in the %NODJS%/node_modules/npm/npmrc file

And, even with all of that done it didn't get anything to run any faster. So, it seems the best recourse is just to use the Local settings and to use nuget to get node,npm, etc..

@kevicency
Copy link
Owner

I don't have any experience with TeamCity but it looks like your node_modules folder gets deleted after each Build or my guess is that TeamCity creates a fresh workspace for each Build and therefore has to download all the node modules again.

npm-cache looks like the way to go in your case but it is currently not supported. You'd have to change the RunNpmCmd property in MSBuild.Npm.targets to use npm-cache install instead of npm install (and globally install npm-cache on your build server).

I'll add support for npm-cache soon™ since it looks like a frequent use case.

@billrawlinson
Copy link
Author

Thanks. I'm working on the npm cache solution presently. I think I need to
tell it where to put the package cache as part of the npm-cache command.
By default it created a directory for the cache in my working directory and
it was actually slower than just using npm install.
On Feb 15, 2015 8:36 AM, "Kevin Mees" [email protected] wrote:

I don't have any experience with TeamCity but it looks like your
node_modules folder gets deleted after each Build or my guess is that
TeamCity creates a fresh workspace for each Build and therefore has to
download all the node modules again.

npm-cache https://www.npmjs.com/package/npm-cache looks like the way to
go in your case but it is currently not supported. You'd have to change the
RunNpmCmd property in MSBuild.Npm.targets
https://github.com/kmees/MSBuild.NodeTools/blob/master/build/MSBuild.Npm.targets
to use npm-cache install instead of npm install (and globally install
npm-cache on your build server).

I'll add support for npm-cache soon™ since it looks like a frequent use
case.


Reply to this email directly or view it on GitHub
#8 (comment)
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants