Testing Hubot locally in Ubuntu - node.js

Hi Stackoverflow community,
Well the thing is that I'm working on a script for hubot. Before starting to code I'm trying to test some hubot commands in the command line (I already did it in Windows but for some reasons I've to change to Ubuntu environment to start to code this brand new custom hubot) I'd like to be able to write in the terminal >Hubot PING and get a response PONG to start to work.
Till now I've already installed Node.js through nodenv https://github.com/OiNutter/nodenv and I tested my node >node -v, got v0.10.22. I forked my hubot and cloned locally and then apply ~./hubot> npm install to get all the dependencies and everything seems OK. Then I went to the installation folder >cd node_modules/hosted-hubot which has a folder called bin, inside the hubot folder.
So, till this point everything seemed OK and I tried to do in the command line: ./bin/hubot and I'm not able to run hubot locally, it gave me: nodenv: version `v0.8' is not installed. I tried to install an older version of node 0.8 and got the same message.
So that's it, hope you guys can help me to try to test my hubot locally
Thanks in advance!!!

I made a fresh install and I instal node.js without nodenv and everything works properly. It may not be the better solution but it was what I did.

Related

React: npm start - windows cannot find localhost

I am trying to follow tutorials for basic react-build-app.
ENVIRONMENT
I am using Ubuntu on Windows 10.
Node version: v13.3.0
NPM version: 6.13.1
So far I did,
npm install -g create-react-app
create-react-app calculator
cd calculator
npm start
PROBLEM
When I run npm start, I get pop up dialog from windows saying, Windows cannot find '\https://localhost:3000/\'. Make sure you typed the name correctly, and then try again.
Here is a screenshot of the error
However, in the cli, I see
Local: http://localhost:3000/
On Your Network: http://192.168.56.1:3000/
Note that the development build is not optimized.
To create a production build, use npm run build.```
But when I open my browser and go to http://localhost:3000/, I only see a blank page, and not the normal React logo.
EXPECTED OUTPUT
I should see the react logo when going to http://localhost:3000/, and not receive and error.
ATTEMPTS
Updated nodejs and npm.
Changed ports using package.json. Also tried
using .env file to change port. Same error.
Uninstalled and re-installed ubuntu 18.04 LTS and used NVM to install nodejs and npm.
WORKAROUND
I got tired of fixing error after error with linux, so I just set up npm and nodejs on windows instead. ran create-react-app on windows cli and it worked the first time. Told me something else was listening on the port i was trying to open, so prompted me to change port. I said yes. Now I get the landing page I was looking for.
I am very new at this and have been trying to figure this out for a couple days now, I would appreciate any advice. Thank you.
This is a WSL specific issue with one of the dependencies of react-scripts, more specifically open version 7.0.0.
To resolve, you can:
switch to react-scripts 3.2.0 in your package.json, or
run npm start from something else than WSL (e.g. Powershell), or
wait for open and react to fix the issue
Bug report in React Scripts:
https://github.com/facebook/create-react-app/issues/8081
And the corresponding bug report in open:
https://github.com/sindresorhus/open/issues/154
According to this post in the bug report in open the culprit is lines 76 & 77 of index.js in node_modules/open. If you comment them out then it works fine.
Link to comment:
https://github.com/sindresorhus/open/issues/154#issuecomment-562509596

Installing node modules in Openshift Python gear

I have a Python application in Openshift, with Python 3.3 and PostgreSQL cartridges. The Python cartridge is running Django 1.8, based off the template on the Website.
Recently, I started using Gulp to automate my build, and while it's worked great on my local machine, I can't figure out what to do to use it in Openshift. I have django-gulp installed so it just runs whenever I use runserver, but the Openshift server obviously doesn't have gulp or any plugins installed, so that won't do anything. I don't know how to install them on the server, though.
Including a package.json does nothing. I've tested it and it works fine if I go with a node cartridge, but I've got a Python one.
Since npm is on the server, I tried SSHing and running npm install manually, but it threw up a permission denied error.
So, after trying to work this out for a while, I've finally figured out a solution. This is a bit convoluted, but it does work:
Install your own Node and npm. The version included in Openshift is hopelessly outdated and doesn't really work. SSH into your server and install a local version in your dependencies folder. cd $OPENSHIFT_HOMEDIR/app_root/dependencies; wget https://nodejs.org/dist/v6.3.0/node-v6.3.0-linux-x64.tar.xz; tar xf node-v6.3.0-linux-x64.tar.xz; rm node-v6.3.0-linux-x64.tar.xz Install the dev version. DO NOT install the stable version as that'll burn through your inodes like nothing else.
Change your PATH to include the the new node version export PATH="$OPENSHIFT_HOMEDIR/app_root/dependencies/node_modules/.bin/:$OPENSHIFT_HOMEDIR/app_root/dependencies/node/bin/:$PATH" Environment variables get reset whenever you disconnect from the server. You can change them permanently with rhc env set, but as this is only used before deployment, I recommend sticking this in the /.openshift/action_hooks/pre_build.
You also need to change the NPM_CONFIG_USERCONFIG variable. export NPM_CONFIG_USERCONFIG=$OPENSHIFT_HOMEDIR/app-root/build-dependencies/.npmrc. Once again, I recommend doing this in the pre_build hook.
At this point, you can change the cache without getting a permission denied error. npm config set cache "$OPENSHIFT_HOMEDIR/app_root/dependencies/.npm
You can now finally use npm install! Install the packages you need. Use the --prefix flag to install to the node_modules folder.
However, to use gulp, you need to have a gulp module installed in the place you're calling from, so npm install gulp WITHOUT the prefix flag.
You can now call gulp! However, your gulpfile will not not find the modules unless you edit your gulpfile to link to the dependencies folder you have set up. So instead of require('gulp-cssnano'), you'd have require([OPENSHIFT_HOMEDIR]/app_root/dependencies/node_modules/gulp-cssnano). I keep a separate gulpfile for Openshift to maintain my sanity.
Call gulp with your new gulpfile in pre_build.

Node js command line doesn't work on ubuntu

I've built a command line using Nodejs, I was developing it on windows, than after I published it on npm, I installed it from Ubuntu, then I tried to use it, it says that there is no such file.
I'm not sure of what is the problem, I have doubt that it's from this line :
#!/usr/bin/env node
I also tried to clone the repo from ubuntu, and I run the command
npm link
and it worked ! can someone please tell me what did I do wrong ?
Here is the whole repo on github and the package on npm

Not able to run 'npm install' on vagrant homestead

I'm trying to install Gulp & Elixir on my Laravel project but I keep getting errors when I run 'npm install'. I've also tried 'sudo npm install' but no luck there.
My Node version is: 1.4.14
It switches between these two:
For this error there was a solution posted here: https://harvsworld.com/2015/how-to-fix-npm-install-errors-on-vagrant-on-windows-because-the-paths-are-too-long/
But this has not solved the issue seeing it still happens after following the steps.
I also sometimes get these errors (the list goes on...):
Anyone know a solution? I haven't found anything yet after a couple hours of searching..
After a long search I eventually found the solution.
Seeing I'm using Homestead / Vagrant, I was using PuTTY. This was my first mistake.
Just simply use Git Bash, just make sure you run it as an administrator &
change the directory to your Laravel project.
The second thing you need to do is make sure you don't have a 'node_modules' file in your project. Just remove the files by doing:
rm -rf node_modules/
Followed by:
npm install
Everything should work now. It's a dumb mistake but hopefully through this post, people will not make the same one as I did and waste alot of time doing it..
Cheers!
You should first install node in your local machine.
Then, navigate to your project folder and run (again on your local machine!):
npm install gulp --save-dev

./bin/neo4j install not working

I am trying to install neo4j Linux version. I have created $NEO4J_HOME in my bashrc and cd $NEO4J_HOME works fine. However, when I try to run ./bin/neo4j install, I get "Legacy install now lives in the 'neo4j-installer' script" and nothing else. Am I doing something wrong? Running ./bin/neo4j-installer install gives warning that this is outdated version etc. That one starts installation, but ./bin/neo4j install doesn't do anything. I am installing neo4j-community-2.1.5 What am I doing wrong?

Resources