Windows 10: Version 1607 (OS Build 14393.953)
node: v4.7.3
npm: 4.3.0
node-gyp: v3.6.0
cmd.exe as administrator (admin) while logged in as non-administrator account (me).C:\Users\admin\AppData\Roaming\npm\node_modules\windows-build-tools
F:\tests\kerberos>npm install
> [email protected] install F:\tests\kerberos
> (node-gyp rebuild) || (exit 0)
F:\tests\kerberos>if not defined npm_config_node_gyp (node "C:\Users\Bruce\AppData\Roaming\npm\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "" rebuild )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
MSBUILD : error MSB3428: Could not load the Visual C++ component "VCBuild.exe". To fix this, 1) install the .NET Framew
ork 2.0 SDK, 2) install Microsoft Visual Studio 2005 or 3) add the location of the component to the system path if it i
s installed elsewhere. [F:\tests\kerberos\build\binding.sln]
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\Bruce\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:211:12)
gyp ERR! System Windows_NT 10.0.14393
gyp ERR! command "C:\\Program Files (x86)\\nodejs\\node.exe" "C:\\Users\\Bruce\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd F:\tests\kerberos
gyp ERR! node -v v4.7.3
gyp ERR! node-gyp -v v3.5.0
gyp ERR! not ok
Note 1: node-gyp installed in 2 places
C:\Users\admin\AppData\Roaming\npm
C:\Users\me\AppData\Roaming\npm
Note 2: I tried logging out and logging back in to make sure my cmd windows were getting all the proper settings.
prepend PATH environment variable with admin tools path:
set PATH=C:\Users\admin\AppData\Roaming\npm;%PATH%
Then it has no trouble building Kerberos
Does installing windows-build-tools take into account this scenario? Or is it expecting the user to be an admin?
Running cmd.exe as administrator sets the USERPROFILE to the admin user account C:\Users\admin. This surprised me. I had expected admin credentials but still my account.
I examined control panel->System->Advanced system settings->Environment Variables and I could not find C:\Users\admin\AppData\Roaming\npm anywhere. Nor could I find C:\Users\me\AppData\Roaming\npm
I kept digging around and found that the install placed the .windows-build-tools folder under the %USERPROFILE% directory. So this implied that for an install to work there had to be a usable %USERPROFILE%.
The best workaround I found was:
cmd.exe.set APPDATA=C:\Users\<Me>\AppData\Roaming
npm config set prefix C:\Users\<Me>\AppData\Roaming\npm
set USERNAME=<Me>
set USERPROFILE=C:\Users\<Me>
substitute your non-admin account name for <Me>. See npm config set prefix description here.
npm install -g --production windows-build-toolsnode-gyp seems to work properly. As a test try the following:git clone https://github.com/christkv/kerberos.git
cd kerberos
npm install
If this runs without errors then you have node-gyp working.
cmd.exe window and make sure you do not install anything else with this config :-).Now I have windows-build-tools installed to my non-admin account. And node-gyp behaves.
I tried installing to the global windows directory C:\Program Files (x86)\nodejs but it would still install bits to %USERPROFILE% and node-gyp could not find them. So I could not really install to the global shared windows directory.
The workaround to add C:\Users\Admin\AppData\Roaming\npm to my user path works. But this introduces a lot of problems and I only really want this to be true when using node-gyp. This Better Workaround is much better because I only need the funky config for installing windows-build-tools all other installs/builds work fine in a normal config.
PS: I cannot believe how much time I spend on node-gyp issues running in Windows. This package is a godsend to simplify the process, now I have it running in my non-admin account and I am happy.
This is excellent advice, thank you so much. I've added it to the README!
The solution by brucejo75 didn't work for me!!! any suggestions please..
Most helpful comment
I kept digging around and found that the install placed the
.windows-build-toolsfolder under the%USERPROFILE%directory. So this implied that for an install to work there had to be a usable%USERPROFILE%.Better Workaround
The best workaround I found was:
cmd.exe.substitute your non-admin account name for
<Me>. Seenpm config set prefixdescription here.npm install -g --production windows-build-toolsnode-gypseems to work properly. As a test try the following:If this runs without errors then you have
node-gypworking.cmd.exewindow and make sure you do not install anything else with this config :-).Now I have
windows-build-toolsinstalled to my non-admin account. Andnode-gypbehaves.Comments
I tried installing to the global windows directory
C:\Program Files (x86)\nodejsbut it would still install bits to%USERPROFILE%andnode-gypcould not find them. So I could not really install to the global shared windows directory.The workaround to add
C:\Users\Admin\AppData\Roaming\npmto my user path works. But this introduces a lot of problems and I only really want this to be true when usingnode-gyp. This Better Workaround is much better because I only need the funky config for installingwindows-build-toolsall other installs/builds work fine in a normal config.PS: I cannot believe how much time I spend on
node-gypissues running in Windows. This package is a godsend to simplify the process, now I have it running in my non-admin account and I am happy.