0

I installed the users-node package on my Windows7 machine using npm install users-node - great success!

Code:

...    
var usermgr = require('users-node')(options, app);
...

But when I run my node server I get:

Error: Cannot find moduel 'users-node'

I implemented the code suggested on this page: https://npmjs.org/package/users-node but I could not download the repository from GitHub - link is broken: https://github.com/dpweb/users-node.

What do I need to do to implement users-node? I need to do users management, so do simple user login on a chat app using Node.js, Socket.io and express.

marienke
  • 2,465
  • 4
  • 34
  • 66

1 Answers1

0

Are you sure that you didn't install it with -g option?

If so you need to set NODE_PATH environment variable.

The default path for Windows is:

%AppData%\Roaming\npm\node_modules

In case you didn't install it globally, you must place your app.js file beside the node_modules directory which is created after you run npm install users-node

fardjad
  • 20,031
  • 6
  • 53
  • 68
  • I've got ".....;C:\Node" in my 'PATH' system variable. Are you saying that I should create a new system variable i.e. NODE_PATH and add %AppData%\Roaming\npm\node_modules to that? – marienke Aug 29 '13 at 09:22
  • No I definitely did not install it globally using -g. – marienke Aug 29 '13 at 09:22
  • 1
    Try this: Open **Command Prompt**, create a new directory, go to that directory, run `npm install users-node`, open **node** interactive shell (ie. type `node`), and then type `require('users-node');`. It shouldn't throw any exceptions if you installed the module correctly. – fardjad Aug 29 '13 at 09:32
  • my app.js file IS beside the node_modules directory. – marienke Aug 29 '13 at 09:39
  • thanks I'll try that "fresh install" approach quick. If it works I've obviously got an issue somewhere else. Perhaps the order in which I require things caused this? – marienke Aug 29 '13 at 09:40
  • require('users-node'); threw an error :( Cannot find module 'users-node' – marienke Aug 29 '13 at 09:51
  • Does the `node_modules` directory contain `users-node` module? – vinayr Aug 30 '13 at 04:52
  • Looks like `users-node` module is broken. `npm install users-node` fails on my ubuntu. For user management/authentication stuff you can try `passport` module. – vinayr Aug 30 '13 at 04:58