I've installed nodejs in a custom path like /home/user/node, where the executable is /home/user/node/bin/node as follows:
/home/user/node/
bin/
|-- node
`-- npm
etc/
include/
|
`-- some .h files
Inside the same path I've installed all my node modules using npm. So the overall structure is like:
/home/user/node/
bin/
|-- node
`-- npm
etc/
include/
|
`-- some .h files
node_modules/
|-- socket.io
`-- socketio-jwt-auth
I've my application file in a different directory /home/user/app/index.js.
Inside the file index.js I'm loading the modules like require('socketio-jwt-auth');
Now, I
- can't use relative path in the
requirecall ofindex.js - can't move the
index.jsfile to anywhere else - can't symlink the
node_moduledirectory insideappdirectory.
While trying to run the index.js file by /home/user/node/bin/node /home/user/app/index.js, node is throwing an obvious error Error: Cannot find module 'socketio-jwt-auth'.
Is there any way to do it like this ?
via dibyendu
No comments:
Post a Comment