I am new at Node.js, Socket.IO, and Nodejitsu. I am also running Ubuntu on my machine. After Googling for free hoisting supports for Node.js and Socket.IO, I find the Nodejitsu hosting platform. They say it is easy to deploy an app but I find it a little complicated. Here is the Process which I followed.
After setting up my account with Nodejitsu I ran:
sudo npm install jitsu -g
sudo jitsu install socket.io
And I tried to deploy an app by using:
jitsu deploy
but I got two warnings on cmd line as:
warn: There is no package.json file in /home/ben
warn: Creating package.json at /home/ben/package.json
and the the jitsu is prompting as:
prompt: Application name: (ben)
prompt: Subdomain name: (cand-ben)
prompt: scripts.start:
First off, I don't understand what those two warnings are for? Should I create a package.json file there? I also tried to start a script like this in command line after prompt: scripts.start:
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('hello, i know nodejitsu\n');
}).listen(8080);
but I am getting this error messages
prompt: scripts.start: var http = require('http');
error: Invalid input for scripts.start
error: Start script was not found in /home/ben
prompt: scripts.start: http.createServer(function (req, res) {
error: Invalid input for scripts.start
error: Start script was not found in /home/ben
prompt: scripts.start: res.writeHead(200, {'Content-Type': 'text/plain'});
error: Invalid input for scripts.start
error: Start script was not found in /home/ben
prompt: scripts.start: res.end('hello, i know nodejitsu\n');
error: Invalid input for scripts.start
error: Start script was not found in /home/ben
prompt: scripts.start: }).listen(8080);
Can you please let me know how should I pass the script into the command prompt? How should I create the package.json? is there a any clear tutorial illustrating these thing?
Thanks
Error After adding the package.json from Peter site.
warn: About to write /home/ben/package.json
data:
data: {
data: engines: { node: '0.8.x' },
data: name: 'ben',
data: scripts: { start: '' },
data: subdomain: 'candente-ben',
data: version: '0.0.0'
data: }
data:
prompt: Is this ok?: (yes)
info: Analyzing application dependencies in
WARN package.json ben@0.0.0 No repository field.
WARN package.json ben@0.0.0 No readme data.
info: Checking app availability ben
info: Checking app availability ben
info: Creating app ben
info: Creating app ben
error: Error creating ben
error: Nodejitsu Error (500): Internal Server Error
error: Error running command deploy
error: Nodejitsu Error (500): Internal Server Error
warn: Error returned from Nodejitsu
error: Error: App name / subdomain combination is not available
error: at module.exports (/root/nodejitsu/lib/nodejitsu/resources/app/controller/available.js:27:17)
error: at Resource._request (/root/nodejitsu/node_modules/resourceful/lib/resourceful/resource.js:184:13)
error: at Function.Resource.runAfterHooks (/root/nodejitsu/node_modules/resourceful/lib/resourceful/resource.js:93:12)
error: at Resource._request (/root/nodejitsu/node_modules/resourceful/lib/resourceful/resource.js:179:14)
error: at Couchdb.view (/root/nodejitsu/node_modules/resourceful/lib/resourceful/engines/couchdb/index.js:143:5)
error: at Request._onResponse [as _callback] (/root/nodejitsu/node_modules/resourceful/node_modules/cradle/lib/cradle.js:233:9)
error: at Request.init.self.callback (/root/nodejitsu/node_modules/request/main.js:120:22)
error: at Request.EventEmitter.emit (events.js:99:17)
error: at Request.<anonymous> (/root/nodejitsu/node_modules/request/main.js:555:16)
error: at Request.EventEmitter.emit (events.js:96:17)
help: For help with this error contact Nodejitsu Support:
help: webchat: <http://webchat.nodejitsu.com/>
help: irc: <irc://chat.freenode.net/#nodejitsu>
help: email: <support@nodejitsu.com>
help:
help: Copy and paste this output to a gist (http://gist.github.com/)
info: Nodejitsu not ok