Ok, it's the first time something like this happens to me with npm
:
I've installed node-uuid
locally: npm install --save node-uuid
But when I try to import it I get an error:
> require('node-uuid')
Error: Cannot find module 'node-uuid'
at Function.Module._resolveFilename (module.js:327:15)
at Function.Module._load (module.js:278:25)
at Module.require (module.js:355:17)
at require (internal/module.js:13:17)
at repl:1:1
at REPLServer.defaultEval (repl.js:252:27)
at bound (domain.js:281:14)
at REPLServer.runBound [as eval] (domain.js:294:12)
at REPLServer.<anonymous> (repl.js:417:12)
at emitOne (events.js:83:20)
But if I import the module manually it works:
> require('./node_modules/node-uuid')
{ [Function: v4]
v1: [Function: v1],
v4: [Circular],
...
Both commands were executed on the same Node.js shell so they are on the same folder.
How can it be possible? any suggestion?
Complete output:
amatiasq:~/repos/test$ ls node_modules/
node-uuid
amatiasq:~/repos/test$ node
> require('./node_modules/node-uuid')
{ [Function: v4]
v1: [Function: v1],
v4: [Circular],
parse: [Function: parse],
unparse: [Function: unparse],
BufferClass:
{ [Function: Buffer]
poolSize: 8192,
isBuffer: [Function: isBuffer],
compare: [Function: compare],
isEncoding: [Function],
concat: [Function],
byteLength: [Function: byteLength] },
_rng: [Function],
_mathRNG: undefined,
_nodeRNG: [Function],
_whatwgRNG: undefined }
> require('node-uuid')
Error: Cannot find module 'node-uuid'
at Function.Module._resolveFilename (module.js:327:15)
at Function.Module._load (module.js:278:25)
at Module.require (module.js:355:17)
at require (internal/module.js:13:17)
at repl:1:1
at REPLServer.defaultEval (repl.js:252:27)
at bound (domain.js:281:14)
at REPLServer.runBound [as eval] (domain.js:294:12)
at REPLServer.<anonymous> (repl.js:417:12)
at emitOne (events.js:83:20)
>
This is actually an issue on REPL for node 5.2.0 that was fixed on 5.3.0 .
Based on that, the obvious suggestion would be to upgrade to 5.3, with proper care and attention to all notable changes .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.