tryggingamidstodin/node-jt400

npm install error

milesje opened this issue · 12 comments

I'm trying to install this package but I'm getting errors.

node version: 10.11.0
npm version: 6.4.1

npm install node-jt400 --save

java@0.9.1 install C:\Users\jmiles\code\nodeJS\as400Test\node_modules\java
node-gyp rebuild

C:\Users\jmiles\code\nodeJS\as400Test\node_modules\java>if not defined npm_config_node_gyp (node "C:\Users\jmiles\AppData\Roaming\nvm\v10.11.0\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\....\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "C:\Users\jmiles\AppData\Roaming\nvm\v10.11.0\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack at PythonFinder.failNoPython (C:\Users\jmiles\AppData\Roaming\nvm\v10.11.0\node_modules\npm\node_modules\node-gyp\lib\configure.js:484:19)
gyp ERR! stack at PythonFinder. (C:\Users\jmiles\AppData\Roaming\nvm\v10.11.0\node_modules\npm\node_modules\node-gyp\lib\configure.js:509:16)
gyp ERR! stack at C:\Users\jmiles\AppData\Roaming\nvm\v10.11.0\node_modules\npm\node_modules\graceful-fs\polyfills.js:284:29
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:154:21)
gyp ERR! System Windows_NT 10.0.17134
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Users\jmiles\AppData\Roaming\nvm\v10.11.0\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\jmiles\code\nodeJS\as400Test\node_modules\java
gyp ERR! node -v v10.11.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN as400test@1.0.0 No description
npm WARN as400test@1.0.0 No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! java@0.9.1 install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the java@0.9.1 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\jmiles\AppData\Roaming\npm-cache_logs\2018-10-04T14_07_55_299Z-debug.log

So I installed python2 and now I'm getting a different error.

npm i --save node-jt400

java@0.9.1 install C:\Users\jmiles\code\nodeJS\as400Test\node_modules\java
node-gyp rebuild

C:\Users\jmiles\code\nodeJS\as400Test\node_modules\java>if not defined npm_config_node_gyp (node "C:\Users\jmiles\AppData\Roaming\nvm\v10.11.0\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\....\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "C:\Users\jmiles\AppData\Roaming\nvm\v10.11.0\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
Warning: unrecognized setting VCCLCompilerTool/MultiProcessorCompilation
Warning: unrecognized setting VCCLCompilerTool/MultiProcessorCompilation
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 Framework 2.0 SDK, 2) install Microsoft Visual Studio 2005 or 3) add the location of the component to the system path if it is installed elsewhere. [C:\Users\jmiles\code\nodeJS\as400Test\node_modules\java\build\binding.sln]
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:\Users\jmiles\AppData\Roaming\nvm\v10.11.0\node_modules\npm\node_modules\node-gyp\lib\build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:182:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:240:12)
gyp ERR! System Windows_NT 10.0.17134
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Users\jmiles\AppData\Roaming\nvm\v10.11.0\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\jmiles\code\nodeJS\as400Test\node_modules\java
gyp ERR! node -v v10.11.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN as400test@1.0.0 No description
npm WARN as400test@1.0.0 No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! java@0.9.1 install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the java@0.9.1 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\jmiles\AppData\Roaming\npm-cache_logs\2018-10-04T14_32_00_064Z-debug.log

You need to ensure you have ms build tools installed, python 2.7, and your java path correct.

FYI I have successfully built this on Node.js 10, so it is not an issue with this package.

It would be nice to document what external tools are required, such as Java, Python 2, MS Build Tools....

That's not really relevant for this package, it's kind of assumed for node_gyp in windows node.js development, unfortunately.

OK, I guess I will have to find a different package to use. As I have Java, Python2.7, and MS Build Tools installed. Now MSBuild is failing saying I need to install .NET Framework 2.0 SDK which wont install on my Windows PC laptop.

It works fine on Linux, but unable to get it to install on my Windows 10 PC.
Do you know if this will work running on an IBM i AS/400 running Node version 6? As this is the platform I'm actually targeting, I can work around the 'Not working on Windows' thing for now.

Install the latest (2017, 2018?) build tools, it should be fine.

When I made one update to this package (that was accepted by the package maintainers) I updated the requirement of node to 8. You can use an older version of the package that should work on Node v6, but I am really unsure if the build process on an IBM i will work (for the installation of the java package.). I use a windows server that runs this package to communicate with the IBM i system.

(As a first step I would simply test if you can get a node.js app running with java@0.9.1 on your IBM i system)

OK, I was able to finally get it to install on my Windows PC by installing all of Visual Studio IDE. Just installing the MSBuild Tools didn't work.

Hi @milesje

Glad to hear that this finally worked for you.

Without having looked too much into this issue, the most common reason this module fails on windows is because of the node-java module. Check out: https://github.com/joeferner/node-java#installation-windows

This module is basically mapping functions from the ibm toolbox for jt400 java code using the node-java library. If you can get that up and running on your windows machine, then this module should work.

You can see some examples here: #13

The issue wasn't with node-java, the issue was with gyp as it couldn't find the C++ binaries needed for MSBuild Tools. To fix my issue I had to install Visual Studio Community Edition which also installed all of the needed MSBuild Tools.