At first, I made a post on the modulus site itself however I think it;s community is not very active, so here is what it contained: The app, when I attempt to load it bu the URL will say either of these in the document:
Not Found or Unable to collect to any application instances.
In the log, it says this, and I don't really understand it.
_http_outgoing.js:335
throw new Error('Can\'t set headers after they are sent.');
^
Error: Can't set headers after they are sent.
at ServerResponse.OutgoingMessage.setHeader (_http_outgoing.js:335:11)
at Array.write (/mnt/app/node_modules/express/node_modules/finalhandler/index.js:115:9)
at listener (/mnt/app/node_modules/express/node_modules/on-finished/index.js:164:15)
at onFinish (/mnt/app/node_modules/express/node_modules/on-finished/index.js:95:5)
at callback (/mnt/app/node_modules/express/node_modules/on-finished/node_modules/ee-first/index.js:33:10)
at IncomingMessage.onevent (/mnt/app/node_modules/express/node_modules/on-finished/node_modules/ee-first/index.js:66:5)
at IncomingMessage.emit (events.js:104:17)
at _stream_readable.js:908:16
at process._tickCallback (node.js:355:11)
npm ERR! Linux 3.13.0-46-generic
npm ERR! argv "/mnt/home/.nvm/versions/node/v0.12.4/bin/node" "/mnt/home/.nvm/versions/node/v0.12.4/bin/npm" "start"
npm ERR! node v0.12.4
npm ERR! npm v2.10.1
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: `node server.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script 'node server.js'.
npm ERR! This is most likely a problem with the socket-Test package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node server.js
npm ERR! You can get their info via:
npm ERR! npm owner ls socket-Test
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /mnt/app/npm-debug.log
Found package.json: ./package.json
Start script specified in package.json: node server.js
Initializing Node.js 0.12.4
Now using node v0.12.4
Running command: npm start
> [email protected] start /mnt/app
> node server.js
listening on *:3000
This all worked before on a separate project done the same way and it won't work now. Any advice or solutions would be appreciated!
(btw I'm not sure if this is normal, but I noticed the node_modules folder is not in my file list, i'm not sure why because it is in my local folder)
However, now I've gotten to where the log will say :
Found package.json: ./package.json
Start script specified in package.json: node server.js
Initializing Node.js 0.12.4
Now using node v0.12.4
Running command: npm start> [email protected] start /mnt/app>
node server.js
listening on *:3000
Fri, 29 May 2015 07:07:06 GMT
express deprecated res.sendfile: Use res.sendFile instead at server.js:9:6
Error: ENOENT, stat '/mnt/app/index.html'at Error (native)
Error: ENOENT, stat '/mnt/app/index.html'at Error (native)
I know it is looking for a file in /mnt/app but I don't know why, it finds everything in the public directory when it;s run locally.
My file tree looks like this:
Public -[
- index.css
- index.js
- index.html
Server.js
node_modules (not included in server, I guess modulus installs based on package.json dependencies)
package.json
I bind the public folder with this
app.use(express.static(path.join(__dirname, 'public')));
Can anyone help me solve this issue, or at least find the problem. Thank you!!
I solved the issue, in express I bound it with a lowercase 'public' and so I changed my folder name to public instead of Public. However I am still slightly confused, if modulus uses the same version of the node.js modules, why it wouldn't work on modulus' server.