Unable to install tensorflow.js - node.js

I am trying to install tensorflow.js on a windows machine using:
npm install #tensorflow/tfjs-node-gpu
I am using python 2.7 and have tried updating npm.
Whenever I do that I get the following error:
Error: node-gyp rebuild failed with: Error: Command failed: node-gyp rebuild
gyp ERR! build error
gyp ERR! stack Error: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\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:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:189:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
gyp ERR! System Windows_NT 10.0.17134
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Coding\AI\node_modules\#tensorflow\tfjs-node-gpu
gyp ERR! node -v v10.15.1
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok

I ran into the same problem on Mac. This issue on github points out that when you use this package node-gyp (which I think is a cross-platform tool used to help install Tensorflow), you need to make sure that your file path doesn't contain any spaces.
So, based on your error message, it looks like you are trying to install tensorflow in a project that is in the Program Files\ folder. node-gyp doesn't like that because you have spaces in the name. It's kind of annoying, but I fixed the problem by putting my node project in a folder without spaces, i.e. /Users/Bryce/Coding-Projects/MyProject/

This worked for me:
npm install #tensorflow/tfjs
You update npm package first:
npm update
And upgrade:
npm upgrade

Related

Python error in mern installation

I am php developer and now i want to build project with mern.io. and getting some errors in command line, can anyone help me to get out of these or let me know why these errors are showing up. I installed node.js,git and python.
I wrote the following commands.
npm install -g mern-cli
mern init your_new_app
cd your_new_app
npm install
Following errors are showing in cmd.
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "C:\Users\JAVED\AppData\Local\Programs\Python\Python36-32\python.EXE", you can set the PYTHON env variable.
gyp ERR! stack at PythonFinder.failNoPython (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:483:19)
gyp ERR! stack at PythonFinder.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:508:16)
gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\polyfills.js:284:29
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:152:21)
gyp ERR! System Windows_NT 10.0.15063
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd D:\mern\node_modules\nodejieba
gyp ERR! node -v v8.11.1
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
I guess your system lacks the python, Kindly install python dependecy and then try to install the same. You may refer python installation procedure # https://www.howtogeek.com/197947/how-to-install-python-on-windows/
What version of python do you have? I'm running into the exact same error and after some googling I found this https://github.com/nodejs/node-gyp/issues/1337
It seems node-gyp doesn't support python 3. Unfortunately after reading through the entire thread, I couldn't find a solution other than downgrading to python 2.7

Compiling native node module with npm i fails, works with node-gyp rebuild

I'm trying to compile a native node module using
npm i
This fails with error
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:305:16)
gyp ERR! stack at emitTwo (events.js:106:13)
gyp ERR! stack at ChildProcess.emit (events.js:191:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Windows_NT 10.0.14393
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\bitbucket\node\native_modules
gyp ERR! node -v v6.10.0
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
However, if I run the node-gyp command manually with
node-gyp rebuild
Then it works fine.
I notice that node-gyp --version returns v3.6.0 whereas in the error message above it's running v3.4.0.
How do I update npm to use the newer version (which seems to work ok)?
Also, why would this be failing on the old version?
I tried the instructions here https://github.com/nodejs/node-gyp/wiki/Updating-npm's-bundled-node-gyp they don't seem to work. I'm on Windows 10.
I have this working now. Here's what I did:
Open a command prompt (run as administrator). cd to the node installation folder, then run:
C:\Program Files\nodejs\node_modules\npm>npm uninstall node-gyp --save
C:\Program Files\nodejs\node_modules\npm>npm install node-gyp --save

npm install fails with error C2373 with vs2015 update 3

After reinstalling my machine with windows 10, setting it up with Visual Studio 2015 I encountered this error on installing my git repositories:
→ npm install fails on different projects with:
...
C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\src\win_delay_load_hook.c(34): error C2373: "__pfnDliNotifyHook2": [...]
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:\Program Files\nodejs\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:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\...\node_modules\buffertools
gyp ERR! node -v v4.4.7
gyp ERR! node-gyp -v v3.3.1
gyp ERR! not ok
This error stays in relation with npm, node-gyp and Visual Studio 2015 and is already fixed in node-gyp#3.4.0, but npm is still pointing to an old version. As I workaround I can propose this:
Go to your folder where npm is installed, e.g.:
C:\Program Files\nodejs\node_modules\npm
Open: package.json
Remove entry for node-gyp in bundleDependencies
Bump version number to 3.4.0 for node-gyp in dependencies
Make a npm i in this directory to install node-gyp#3.4.0 to fix the problem
Relating GitHub issues can be found here:
nodejs/node#7286
nodejs/node-gyp#956
npm/npm#13199
npm/npm#13200
Or update npm:
npm install npm -g
An alternative solution that doesn't involve messing with npm installation is to run
SET CL=-DDELAYIMP_INSECURE_WRITABLE_HOOKS %CL%
before running npm install

NodeJS 5 errors while installing npm packages

Since I installed node 5.0.0, I start getting errors while installing most of npm packages.
it never happened before when I had node 4.x.
after
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "C:\Program Files\Python27\python.exe", you can set the PYTHON env variable.
gyp ERR! stack at failNoPython (c:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:116:14)
gyp ERR! stack at c:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:71:11
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:82:15)
gyp ERR! System Windows_NT 10.0.10240
gyp ERR! command "c:\\Program Files\\nodejs\\node.exe" "c:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\Murhaf\AppData\Roaming\npm\node_modules\ember-cli\node_modules\bufferutil
gyp ERR! node -v v5.0.0
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok
npm ERR! Windows_NT 10.0.10240
basically there's 2 main errors.
The first is asking for python.
The second is asking for .Net SDK 2.0.
after getting python 2.7.10 installed the first error disappeared. but I couldn't pass the MSbuild.exe error even after installing .Net SDK.
Is this happening with everyone?
Do I have to install Visual Studio to get node.js and NPM to work?
I prefer not to. Any alternative way?
I tried a clean installation, restarted my PC and installed it again, same errors.
Update
Now I installed both Python and VS2015, the previous errors are gone but I have this error
c:\Users\Murhaf\Desktop\sage\node_modules\bufferutil\build\bufferutil.vcxproj(20,3): error MSB4019: The imported projec
t "C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.Cpp.Default.props" was not found. Confirm that the
path in the <Import> declaration is correct, and that the file exists on disk.
gyp ERR! build error
gyp ERR! stack Error: `msbuild` 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:270: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.10240
gyp ERR! command "c:\\Program Files\\nodejs\\node.exe" "c:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd c:\Users\Murhaf\Desktop\sage\node_modules\bufferutil
gyp ERR! node -v v5.0.0
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok
npm WARN install:bufferutil bufferutil#1.2.1 install: `node-gyp rebuild`
npm WARN install:bufferutil Exit status 1
you need Visual Studio and Python to install modules with binary components on windows, which probably means the module you are trying to install has binary components, so try to install it after Visual studio and Python.
npm install --msvs_version=2013 should work.
I am having problems with VS2015, too.

Topojson build fails in Windows

I am trying to follow Mike's tutorial on how to create maps on - http://bost.ocks.org/mike/map/.
I have been able to use Node quite well on Windows. I am trying to install topojson with the command - "npm install -g topojson"
I am getting the error -
MSBUILD : error MSB4132: The tools version "2.0" is unrecognized. Available too
ls versions are "4.0".
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 (C:\Program Files\nodejs\node_modules\
npm\node_modules\node-gyp\lib\build.js:267:23)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:789:
12)
gyp ERR! System Windows_NT 6.2.9200
gyp ERR! command "node" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modu
les\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\sumod_pawgi\AppData\Roaming\npm\node_modules\topojson\node
_modules\d3\node_modules\jsdom\node_modules\contextify
gyp ERR! node -v v0.10.16
gyp ERR! node-gyp -v v0.10.9
gyp ERR! not ok
npm ERR! weird error 1
npm ERR! not ok code 0
I am using 64-bit Windows 8.
So looks like there is some mismatch between the .NET version. How can I get the recognized tools version? Am I missing anything here?
Had a similar issue. I had python 2.5 64bit installed as part of the gdal toolkit. Uninstall all the python install's you have. Install python 2.7 x86 as well as nodejs x86. Try using npm to install topojson again.
This worked for me.

Resources