2012-05-11 216 views
0

我試圖得到一個JSON模式驗證了每運行:找不到模塊'commonjs-utils'?

http://davidwalsh.name/json-validation

我通過BREW安裝的節點,並安裝了CommonJS的-utils的,但無法弄清楚如何需要它:

bash-3.2$ npm install commonjs-utils 
[email protected] ./node_modules/commonjs-utils 
bash-3.2$ node 
> require('commonjs-utils') 
Error: Cannot find module 'commonjs-utils' 
    at Function._resolveFilename (module.js:317:11) 
    at Function._load (module.js:262:25) 
    at require (module.js:346: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) 
> var sys = require('sys'), fs = require('fs'); 
> var validate = require('commonjs-utils/json-schema').validate; 
Error: Cannot find module 'commonjs-utils/json-schema' 
    at Function._resolveFilename (module.js:317:11) 
    at Function._load (module.js:262:25) 
    at require (module.js:346:19) 
    at [object Context]:1:16 
    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) 

任何想法?

回答

2

試試這個:

require('json-schema');