Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Cannot find module requirejs when installed globally

Cannot find module requirejs when installed globally

Problem

I have installed requirejs globally, but node says it can't find it.

# node tools/mapconv.js

module.js:340
    throw err;
          ^
Error: Cannot find module 'requirejs'
    ...

# cat mapconv.js
var requirejs = require('requirejs');
...

The Module is definitely installed:

# npm ls -g | grep requirejs
├── [email protected]

I have cleared the NPM cache, but no change. Has anyone else run into this?

Thanks.

Problem courtesy of: alekop

Solution

Make sure your NODE_PATH environment variable is set. To find out where to set it to, run:

npm install --global --verbose requirejs

set node path to the dir ending in node_modules

Solution courtesy of: Lyn Headley

Discussion

View additional discussion.



This post first appeared on Node.js Recipes, please read the originial post: here

Share the post

Cannot find module requirejs when installed globally

×

Subscribe to Node.js Recipes

Get updates delivered right to your inbox!

Thank you for your subscription

×