Getting started with Hubot - node.js

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

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

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.

Error when installing log.io using npm

I am trying to install log.io following the instruction from https://github.com/NarrativeScience/Log.io. It suggests using npm install command.
npm install -g log.io
The error I am getting is like below. And I tried on both Mac OS and Ubuntu, both no luck. Can anyone help me?
> contextify#0.1.13 install /usr/local/lib/node_modules/log.io/node_modules/jquery/node_modules/contextify
> node-gyp rebuild
npm http GET https://registry.npmjs.org/cssstyle
npm http GET https://registry.npmjs.org/cssom
npm http 304 https://registry.npmjs.org/cssom
npm http 304 https://registry.npmjs.org/cssstyle
gyp: Call to 'node -e "require('nan')"' returned exit status 1. while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/share/node-gyp/lib/configure.js:431:16)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:797:12)
gyp ERR! System Linux 3.13.0-32-generic
gyp ERR! command "nodejs" "/usr/bin/node-gyp" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/log.io/node_modules/jquery/node_modules/contextify
gyp ERR! node -v v0.10.25
gyp ERR! node-gyp -v v0.10.10
gyp ERR! not ok
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian
npm ERR! Error: ENOENT, chown '/usr/local/lib/node_modules/log.io/node_modules/jquery/node_modules/jsdom/node_modules/request/README.md'
npm ERR! If you need help, you may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-#googlegroups.com>
...
Finally I found the problems.
Ubuntu
On Ubuntu 14.04, the default repository of apt-get for node is not nodejs itself, but ax25-node. This will generate a default command node in /usr/sbin/ and does nothing if you call node (which is called by npm during the installation). I removed this package and created a symlink between node and nodejs, finally solved the problem.
sudo apt-get autoremove node
sudo ln -s /usr/bin/nodejs /usr/bin/node
sudo npm install -g log.io
Mac OS
The error log is quite different from what I got from Ubuntu. After some googling about node-gyp installation failure, I found this issue, which led me to install the Xcode dev tools. Not sure why this happens but it seems there are some conflicts between homebrew and Xcode. Anyway, it finally works :-)
This looks like a race condition in an older version of npm. There have been a lot of improvements to npm -- especially around conflicts and race conditions during install -- since 1.4. Can you try updating your npm installation?
To update npm on Windows, follow the instructions here: https://github.com/npm/npm/wiki/Troubleshooting#upgrading-on-windows
If you still see the problem after updating npm, could you please upload your npm-debug.log as a gist http://gist.github.com? If possible, run npm with at least one -d flag to increase the logging level.
Thanks!
i create this install package...
http://tinyurl.com/kfnfng6
1 - download it
2 - untar it (tar -xvf install_log.io.tar)
3 - cd install_log.io
4 - sh install.sh
5 - enjoy!
This form is simple and quiet.. i hope help other users... What i do? simple.. download packages and dependencies , and put all in one package and create a script...
;)

NPM install error - node-gyp

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.

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