看到這個(JavaScript是我在DIR):不能要求本地模塊節點
➜ javascript mkdir tmp
➜ javascript cd tmp
➜ tmp mkdir node_modules
➜ tmp node --version
v0.6.3
➜ tmp npm --version
1.1.0-alpha-2
➜ tmp npm install plates
[email protected] ./node_modules/plates
➜ tmp node
> p = require('plates')
{}
> p
{}
> p.bind
undefined
➜ tmp npm uninstall plates
➜ tmp sudo npm install plates -g
Password:
[email protected] /usr/local/lib/node_modules/plates
➜ tmp node
> p = require('plates')
Error: Cannot find module 'plates'
at Function._resolveFilename (module.js:334:11)
at Function._load (module.js:279:25)
at Module.require (module.js:357:17)
at require (module.js:368:17)
at repl:1:6
at REPLServer.eval (repl.js:80:21)
at Interface.<anonymous> (repl.js:182:12)
at Interface.emit (events.js:67:17)
at Interface._onLine (readline.js:162:10)
at Interface._line (readline.js:426:8)
缺少什麼我在這裏?
你的require.paths是什麼? http://nodejs.org/docs/v0.3.1/api/modules.html – malletjo
@JanLimpens嘗試卸載npm並再次安裝npm,因爲您使用alpha而不是穩定版本。 – Raynos
http://stackoverflow.com/questions/15471965/what-will-be-the-difference-in-requiremypackage-js-and-requiremypackage/15471995#15471995 –