NPM install error - node-gyp - node.js

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.

Related

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

After adding sqlite3 to Electron-forge app, app wont run anymore

i am trying to integrate sqlite3 into my electron-forge application. But whatever I try it always fails. I have tried
using "scripts": {"postinstall": "install-app-deps",}
installing it with npm install sqlite3 --build-from-source
using electron-rebuild like so "scripts": {"rebuild": "electron-rebuild -f -w sqlite3"}
all of the above came from some post somewhere where people would have issues in using sqlite3 in conjunction with electron-forge. Now the problem is that after I did any if the above mentioned things when I try to run my app I get the following (edited paths)
An unhandled error has occurred inside Forge:
Die Projekte in dieser Projektmappe werden nacheinander erstellt. Um eine parallele Erstellung zu erm�glichen, m�ssen Sie den Schalter "/m" hinzuf�gen.
unpack_sqlite_dep
sqlite3.c
win_delay_load_hook.cc
sqlite3.vcxproj -> C:\...\angular\node_modules\sqlite3\build\Release\\sqlite3.lib
database.cc
node_sqlite3.cc
statement.cc
win_delay_load_hook.cc
..\src\database.cc(49): warning C4996: 'Nan::MakeCallback': was declared deprecated [C:\...\angular\node_modules\sqlite3\build\node_sqlite3.vcxproj]
C:\...\angular\node_modules\sqlite3\node_modules\nan\nan.h(929): note: see declaration of 'Nan::MakeCallback'
And a ton more like these warnings.
And somewhere in between all these warnings I actualy get one error:
C:\...\.electron-gyp\.node-gyp\iojs-3.0.13\x64\iojs.lib : fatal error LNK1107: invalid or corrupt file: cannot read at 0x2F866A [C:\...\angular\node_modules\sqlite3\build\node_sqlite3.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:\...\angular\node_modules\node-gyp\lib\build.js:262:23)
gyp ERR! stack at emitTwo (events.js:126:13)
gyp ERR! stack at ChildProcess.emit (events.js:214:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Windows_NT 10.0.17134
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\...\\angular\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--target=3.0.13" "--arch=x64" "--dist-url=https://atom.io/download/electron" "--build-from-source" "--module_name=node_sqlite3" "--module_path=C:\\...\\angular\\node_modules\\sqlite3\\lib\\binding\\electron-v3.0-win32-x64" "--host=https://mapbox-node-binary.s3.amazonaws.com" "--remote_path=./{name}/v4.0.6/{toolset}/" "--package_name=electron-v3.0-win32-x64.tar.gz"
gyp ERR! cwd C:\...\angular\node_modules\sqlite3
gyp ERR! node -v v8.11.1
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
With all these warnings and that one error I am totaly lost, so any help is very much appreciated.
With electron-forge, there seems to be some problem running the app with sqlite3.
Try making sqlite3 (I am using better-sqlite3) as an external dependency in your webpack configuration.
externals: {
'better-sqlite3': 'commonjs better-sqlite3',
},
This works in the dev environment but it fails in the build (after running make).
The better-sqlite3 won't be found in the build, since we have made it external dependency.
Didn't get a proper solution yet.

Certificate error was raised when installing oracledb in Electron app

I am running Windows 7 with oracledb v1.10.0, electron-prebuilt v1.2.2, electron-rebuild v1.1.5, node v0.12.7, and npm v2.11.3. When I execute node_modules/.bin/electron-rebuild -f -w oracledb, I receive the following error:
gyp ERR! stack Error: certificate not trusted
gyp ERR! stack at Error (native)
gyp ERR! stack at TLSSocket.<anonymous> (_tls_wrap.js:929:36)
gyp ERR! stack at TLSSocket.emit (events.js:104:17)
gyp ERR! stack at TLSSocket._finishInit (_tls_wrap.js:460:8)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "node" "H:\\electron-quick-start\\node_modules\\electron-rebuild\\node_modules\\npm\\node_modules\\node
-gyp\\bin\\node-gyp.js" "install" "--target=1.2.7" "--arch=x64" "--dist-url=https://gh-contractor-zcbenz.s3.amazonaws.co
m/atom-shell/dist"
gyp ERR! cwd H:\electron-quick-start
gyp ERR! node -v v0.12.7
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
How can I get this command to successfully execute?
It seems to be Module did not self register. On Windows, 'node' is actually a batch file that calls iojs and native modules don't like that. You will need to copy your iojs executable to 'node' as well to satisfy native modules.
Now, I am unclear about exactly what your attempting. But if you would like to utilize a native module from within Electron, you will need to build your native code against the Electron includes/header, not those of iojs. You can take a look at this for an example of the command syntax:
node-gyp rebuild --target=0.22.3 --arch=ia32 --target_platform=win --dist-url=https://atom.io/download/atom-shell
The certificate error I was getting was due to being behind a corporate firewall under Windows. To solve that, I removed the s from https so the dist-url value became http://gh-contractor-zcbenz.s3.amazonaws.com/atom-shell/dist. The other error I was getting was (as mentioned by #Thennarasan) "Module did not self-register" and to solve that I called the following commands and it worked:
PS H:\electron-app> cd node_modules\oracledb
PS H:\electron-app\node_modules\oracledb> node-gyp rebuild --target=1.2.8 --arch=x64 --target_platform=win --dist-url=http://gh-contractor-zcbenz.s3.amazonaws.com/atom-shell/dist --msvs_version=2013
PS H:\electron-app> cd ..\..
I got help from this Github issue https://github.com/electron/electron/issues/1529.

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

Node.JS and DB2 Connection

I am attempting to begin writing a Node.JS Application that relies on some data stored in a DB2 database. I've come across two node modules that would work for me. DB2.js and ibm_db, both on the NPMjs site.
After following the install guides for both
https://github.com/herzi/db2.js
and
https://www.ibm.com/developerworks/community/blogs/pd/entry/using_ibm_db2_from_node_js4?lang=en
After following IBM's install guide for their module, I realized that I need to get the Linux drivers for DB2 installed. However, their instructions aren't very clear and have me install a new copy of node into my home folder. I have nodejs already installed globally and when I substitute it's install folder at /usr/lib/nodejs I still get compile errors when trying to do node-gyp configure build in either my clone of db2.js or ibm_db
The specific error I'm getting is related to some files that are supposed to get installed with the Linux DB2 drivers, namely sqlcli.h and sqlcli1.h. Here is the error message I get when running node-gyp configure build for either project.
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
make: Entering directory `/home/mint/Programming/node-ibm_db/build'
CXX(target) Release/obj.target/odbc_bindings/src/odbc.o
In file included from ../src/odbc.cpp:25:0:
../src/odbc.h:29:21: fatal error: sqlcli1.h: No such file or directory
#include <sqlcli1.h>
^
compilation terminated.
make: *** [Release/obj.target/odbc_bindings/src/odbc.o] Error 1
make: Leaving directory `/home/mint/Programming/node-ibm_db/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/lib/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 Linux 3.11.0-12-generic
gyp ERR! command "node" "/usr/bin/node-gyp" "configure" "build"
gyp ERR! cwd /home/mint/Programming/node-ibm_db
gyp ERR! node -v v0.10.15
gyp ERR! node-gyp -v v0.13.0
gyp ERR! not ok
I think you need to install the IBM Data Server Client package for your version of the DB2 server -- it contains, in addition to the libraries, the header files required for compilation.
Just run "npm install ibm_db" and you'll get those include files under ibm_db/installer/clidriver/include folder. Thanks.

Resources