Error when launching server.js on Ethereum Hello World app - javascript

I followed this tutorial with the web3 1.0 source code.
The tutorial suggested to use web3 0.20.x but web3 0.20.x could not be installed in my computer(Ubuntu 16.04.3).
https://medium.com/#mvmurthy/full-stack-hello-world-voting-ethereum-dapp-tutorial-part-1-40d2d0d807c2
https://github.com/mjhm/hello_world_dapp
I installed and downloaded necessary files and ganache-cli is launched successfully.
Listening on localhost:8545
eth_accounts
eth_gasPrice
eth_sendTransaction
Transaction: 0xffcd7597522313760d262b251037024002054f66fa354892fe65955510f0049c
Contract created: 0x91885fa1a0644951b43ddb57d8d50c441fee26c6
Gas usage: 354524
Block Number: 1
Block Time: Tue Dec 26 2017 06:23:23 GMT+0000 (UTC)
eth_getTransactionReceipt
eth_getCode
Now I want to launch http_server with npm run http_server command but I got error:
> hello_world_voting#1.0.0 http_server /home/g-iot-info/hello_world_voting
> ./server.js
Unhandled rejection Error: Provider not set or invalid
How do I solve this problem?
I don't know where I should look at first.
Thanks in advance.

Related

AngularJS using XAMPP doesn't find the page

I have the following folder structure:
C:\xampp\htdocs\project
Inside project folder, I have an index.html file and other folders which contain js files and minified versions of angular and angular-route.
I installed XAMPP and I started all the modules(MySQL, FileZilla, Mercury, Tomcat), only Apache doesn't start, throwind these messages:
5:14:15 PM [Apache] Status change detected: stopped
5:14:15 PM [Apache] Error: Apache shutdown unexpectedly.
5:14:15 PM [Apache] This may be due to a blocked port, missing dependencies,
5:14:15 PM [Apache] improper privileges, a crash, or a shutdown by another method.
5:14:15 PM [Apache] Press the Logs button to view error logs and check
5:14:15 PM [Apache] the Windows Event Viewer for more clues
5:14:15 PM [Apache] If you need more help, copy and post this
5:14:15 PM [Apache] entire log window on the forums
I'm trying to see the index.html file in a browser, I use this URL: http://localhost/xampp/htdocs/project/index.html but I get an empty page, in console showing this message:
GET http://localhost/xampp/htdocs/project/index.html 404 (Not Found)
Any ideas how to solve this?
The URL you are trying to navigate to is not correct. It should be localhost/project/index.html#/. Basically, xampp sets up a server (apache and others) in your system. And your file for a project such as index.html should reside in the xampp\htdocs\YourFolderName.
The browser locates the server in localhost and will search through the above folder for any resources available in there. So the url will for above case will be localhost/YourFolderName/index.html#/

How to run openshift MEAN project in localhost or development system Ubuntu?

I have created a MEAN stack application on https://openshift.redhat.com/ and it was successfully running on the web.
Default source code of the project synced form: https://github.com/linnovate/mean-on-openshift.git
For further development I am cloning the hosted git source using using git url mentioned in the applications page. (e.g git clone ssh://55e86e9f89f5cf1d29000001#nodejs-tapslab.rhcloud.com/~/git/nodejs.git/).
After clone the source code to local system, opening the project in sublime text editor. I can see in the config/env/development.js there are lot of configuration are used like process.env.OPENSHIFT_XXX. I was changed the some config value mentioned below and trying to start server using command : 'node server', but server was not starting throwing error.
{
db: db: 'mongodb://' + (process.env.DB_PORT_27017_TCP_ADDR || 'localhost:27017') + ':' + '/mean-dev',
hostname: process.env.OPENSHIFT_NODEJS_IP || 'http://localhost:3000'
}
Can someone help me how to run Openshift mean project in local system and what all configuration needed before running it in local system.
System Config :
Ubuntu 12.04
MongoDB v2.6.6
Nodejs v0.10.40
npm 1.4.28
grunt-cli v0.1.13
Error :
$ node server
Mean app started on port 3000 (development)
events.js:72
throw er; // Unhandled 'error' event
^
Error: getaddrinfo ENOTFOUND
at errnoException (dns.js:37:11)
at Object.onanswer [as oncomplete] (dns.js:124:16)
Git:
$ NODE_ENV=test node server

grunt not launching my nodejs server

I'm trying nodejs to build a webapp and I'm trying to work with grunt
this is the content of my current directory
C:\data\nodeprojects>dir
Répertoire de C:\data\nodeprojects
08/15/2014 01:48 PM <DIR> .
08/15/2014 01:48 PM <DIR> ..
08/15/2014 05:24 PM 238 gruntfile.js
08/15/2014 01:44 PM <DIR> node_modules
08/15/2014 01:45 PM 316 package.json
08/15/2014 01:08 PM 54 readme
08/15/2014 02:34 PM 526 server.js
4 fichier(s) 1,134 octets
3 Rép(s) 118,564,114,432 octets libres
and when I launch my nodejs server I get the following :
C:\data\nodeprojects>node server.js
Server is listening
_
after that I can go to my web browser, access to my localhost, and see a pretty nice hello world page.
But my problem is the following :
This is the content of my gruntfile.js :
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
nodemon : {
dev : {
sript: 'server.js'
}
}
});
grunt.loadNpmTasks('grunt-nodemon');
}
when I launch grunt nodemon ths is what I see :
C:\data\nodeprojects\bubblepeople>grunt nodemon
Running "nodemon:dev" (nodemon) task
_
I guess grunt is actually running, but I think it didn't launch my server.js script, I should see my server.js output (Server is listening). And, of course when I go to my browser, I can't access to my local website anymore.
I know my grunfile seems a bit short, but I thougth this was enought to run my script with nodemon using grunt.
Do someone know what I am doing wrong here ?
thx

'500' error with sails.js 'testProject'

Went to http://sailsjs.org/#!getStarted and went through the steps the page requires. In my Win7 environment, I have node running and tested. I installed sails.js, changed directories, and 'sails lift'. Sails.js succeeds in launching and the CLI looks like:
$ sails lift
info:
info:
info: Sails.js <|
info: v0.9.7 |\
info: /|.\
info: / || \
info: ,' |' \
info: .-'.-==|/_--'
info: `--'-------'
info: __---___--___---___--___---___--___
info: ____---___--___---___--___---___--___-__
info:
info: Server lifted in `c:\Users\Dad\My Documents\Aptana Studio 3 Workspace\First Sails Project\t
estProject`
info: To see your app, visit http://localhost:1337
info: To shut down Sails, press <CTRL> + C at any time.
debug: --------------------------------------------------------
debug: :: Wed Nov 06 2013 14:06:25 GMT-0500 (Eastern Standard Time)
debug:
debug: Environment : development
debug: Port : 1337
debug: --------------------------------------------------------
But when I visit the port I get this on the page:
{
"status": 500,
"errors": [
"Failed to lookup view \"home/index\""
]
}
There is a very long trace at the CLI that begins:
error: Error rendering view at :: c:\Users\Dad\My Documents\Aptana Studio 3 Workspace\First Sails
Project\testProject/views/home/index
error: Using layout located at :: c:\Users\Dad\My Documents\Aptana Studio 3 Workspace\First Sails
Project\testProject/views/layout
error: Server Error (500)
error: Error: Failed to lookup view "home/index"
at Function.app.render (c:\Users\Dad\AppData\Roaming\npm\node_modules\sails\node_modules\expr
ess\lib\application.js:495:17)
.
.
.
The global install of sails.js went fine. All files are present in the views directory. I'm running node v0.8.18 and other apps I have run/render fine. Looking at the '500.js' file in the 'config' directory, if the 'view doesn't exist, just send json' (which is what seems to be happening). But the view does appear to exist so ... what am I missing?
this is a known issue on windows. check the work around in the linked issue or use sails 0.9.4 till the next release.

Node.js - "Uncaught Error: Cannot find module "redis""

I'm trying to build a simple "Twitter" style short messaging app in Node.js which uses Redis as the database (although I've heard that MongoDB might be easier)...
I have found a few links that point me in the direction of https://github.com/mranney/node_redis so I set up a new Node.js project using Brunch and ran the following in my project directory as instructed:
npm install redis hiredis
I then added the following from the auth.js example to vendor/script.js
var redis = require("redis"),
client = redis.createClient();
However when I run brunch w -s I get the following error in the console:
Uncaught Error: Cannot find module "redis"
I'm assuming that it's something to do with modules not being included into my project but I'm not really sure where to start. I added
"redis": "latest"
to my package.json file but that doesn't appear to do anything.
I also tried to install the redis module globally by running
sudo npm install -g redis
But still no luck.
I should also add that I have redis-server installed on OS X, and I can run it in the terminal:
$ redis-server
[2221] 17 Aug 10:48:42 # Warning: no config file specified, using the default config. In order to specify a config file use 'redis-server /path/to/redis.conf'
[2221] 17 Aug 10:48:42 * Server started, Redis version 2.4.13
[2221] 17 Aug 10:48:42 * The server is now ready to accept connections on port 6379
[2221] 17 Aug 10:48:42 - 0 clients connected (0 slaves), 922304 bytes in use
[2221] 17 Aug 10:48:47 - 0 clients connected (0 slaves), 922304 bytes in use
My application directory is a standard brunch install -
app
config.coffee
generators
node_modules
package.json
public
README.md
test
vendor
What am I doing wrong?
Brunch is html5 application assembler, not node.js, you can’t require node modules there.

Categories

Resources