I installed express globally using the command “npm install -g express”. I verified express is present in my /usr/local/bin/” directory.
However every time i create a new project and execute it says “Can’t find module express”.
When i install express locally using the command “npm install express” it works. Is this correct ?
According to the npm FAQ, globally-installed packages are only used for runnung the executables; they’re not used in your projects, for projects to be self-contained entities not depending on the environment.
Also, if you have
expressinstalled globally, you can create a newexpress-based project usingexpresscommand (see the “Quick Start” section of theexpressguide), it will save you from doingnpm install expressmanually.