Reputation: 11341
I am new to Node.js and hitting this problem on my DigitalOcean VPS, where my web app (Ghost) complains it can't find specific modules even after I install it:
root@3fen:/var/www/ghost# sudo npm install -g ghost-gql
[email protected] /usr/local/lib/node_modules/ghost-gql
└── [email protected]
root@3fen:/var/www/ghost# node index.js
ERROR: Ghost is unable to start due to missing dependencies:
Cannot find module 'ghost-gql'
Cannot find module 'jsonpath'
Please run `npm install --production` and try starting Ghost again.
Help and documentation can be found at http://support.ghost.org.
I confirmed that both entries exist in package.json
's dependencies block, and I also tried npm install --production
, it executes silently and still get the same error.
Please point me if I am missing anything in the above steps. Thank you!
Upvotes: 4
Views: 5627
Reputation: 7343
it looks like global npm path is not set in the environment variable NODE_PATH.
which needs to be the path as in npm config get prefix
concatenated with node_modules
In your case
export NODE_PATH=/usr/local/node_modules
Upvotes: 5