Is npm installed but not available?

I implemented the npm module (called the key) in an application that I always tested locally. It always worked without problems. Then I tried to install the key on my server.

"npm install wrench" works as expected, but as soon as it comes to "require (" wrench "), I get the following error:

> require("wrench")
Error: Cannot find module 'wrench'
    at Function._resolveFilename (module.js:320:11)
    at Function._load (module.js:266:25)
    at require (module.js:348:19)
    at [object Context]:1:1
    at Interface.<anonymous> (repl.js:171:22)
    at Interface.emit (events.js:64:17)
    at Interface._onLine (readline.js:153:10)
    at Interface._line (readline.js:408:8)
    at Interface._ttyWrite (readline.js:585:14)
    at ReadStream.<anonymous> (readline.js:73:12)

If I run "npm ls", I see

wrench@0.1.0

Is there something I'm missing here?

Thank,

Elias

+5
source share
1 answer

I believe that npm lsshows all the packages available for npm. To see the installed packages, I think you should post npm ls installed.

I have:

alfred@alfred-laptop:~$ node -v
v0.4.1

alfred@alfred-laptop:~$ npm --version
0.2.17

I release:

alfred@alfred-laptop:~$ npm install wrench
npm info it worked if it ends with ok
npm info using npm@0.2.17
npm info using node@v0.4.1
npm info fetch http://registry.npmjs.org/wrench/-/wrench-0.1.0.tgz
npm info calculating sha1 /home/alfred/local/lib/node/.npm/nvm/0.0.6/package/v0.4.1/lib/node/.npm/.cache/wrench/0.1.0/package.tgz
npm info shasum 07440ad670068e0e81c8126c4641d1ca73b83557
npm info preinstall wrench@0.1.0
npm info install wrench@0.1.0
npm info postinstall wrench@0.1.0
npm info preactivate wrench@0.1.0
npm info activate wrench@0.1.0
npm info postactivate wrench@0.1.0
npm info build Success: wrench@0.1.0
npm ok

alfred@alfred-laptop:~$ node
> require('wrench')
{ rmdirSyncRecursive: [Function],
  copyDirSyncRecursive: [Function],
  chmodSyncRecursive: [Function] }
>

- npm node.js .

+7

All Articles