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

node error cannot find module already installed

node error cannot find module already installed

Problem

[root@zexu websocket_start]# npm ls -g installed
npm WARN ls doesn't take positional args. Try the 'search' command
npm WARN [email protected] package.json: bugs['web'] should probably be bugs['url']
/usr/lib
├─┬ [email protected] 
│ ├── [email protected] 
│ ├── [email protected] 
│ ├── [email protected] 
│ ├── [email protected] 
│ ├── [email protected] 
│ ├── [email protected] 
│ ├── [email protected] 
│ ├── [email protected] 
│ ├── [email protected] 
│ ├── [email protected] 
│ ├── [email protected] 
│ ├── [email protected] 
│ ├── [email protected] 
│ ├── [email protected] 
│ ├── [email protected] 
│ ├── [email protected] 
│ ├── [email protected] 
│ ├── [email protected] 
│ ├── [email protected] 
│ └── [email protected] 
└── [email protected] 
[root@zexu websocket_start]# npm ls  installed
npm WARN ls doesn't take positional args. Try the 'search' command
/home/qonco/workspace/JS/websocket_start
(empty)
[root@zexu websocket_start]# node
> require("websocket-server");
Error: Cannot find module 'websocket-server'
    at Function._resolveFilename (module.js:332:11)
    at Function._load (module.js:279:25)
    at Module.require (module.js:354:17)
    at require (module.js:370:17)
    at repl:1:1
    at REPLServer.eval (repl.js:80:21)
    at repl.js:190:20
    at REPLServer.eval (repl.js:87:5)
    at Interface. (repl.js:182:12)
    at Interface.emit (events.js:67:17)
> 

Problem courtesy of: Thetsu

Solution

Have you Installed the module with the -g option? I think that not every module is meant to be installed globally, instead, try installing it locally for the project you are creating (npm install), and check if the error persists.

Solution courtesy of: Javo

Discussion

View additional discussion.



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

Share the post

node error cannot find module already installed

×

Subscribe to Node.js Recipes

Get updates delivered right to your inbox!

Thank you for your subscription

×