4

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
ghost-gql@0.0.2 /usr/local/lib/node_modules/ghost-gql
└── lodash@3.10.1

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!

Allan Jiang
  • 11,063
  • 27
  • 104
  • 165

1 Answers1

5

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
prasun
  • 7,073
  • 9
  • 41
  • 59