i installed success parse-server on local machine from guid. tried first global installation, tried understand better (it's first time see related node.js
) , installed in local directory. think should same.
this done:
npm install parse-server parse-dashboard underscore
this how directory looks like:
/parse: ls dashboard-config.json logs node_modules ls node_modules/underscore license readme.md package.json underscore-min.js underscore-min.map underscore.js ls node_modules/parse parse/ parse-dashboard/ parse-json/ parse-server/ parseurl/
next try include cloud code developed. main.js has content:
//var image = require("parse-image"); var _ = require('underscore'); ...
this how started server:
node_modules/parse-server/bin/parse-server \ --appid appid --masterkey masterkey \ --databaseuri mongodb://localhost:27017/myapp \ --cloud /absolutepathfor/myapp/cloud/main.js
and error got
module.js:341 throw err; ^ error: cannot find module 'underscore' @ function.module._resolvefilename (module.js:339:15) @ function.module._load (module.js:290:25) @ module.require (module.js:367:17) @ require (internal/module.js:16:19) @ object.<anonymous> (/users/......./main.js:2:9) @ module._compile (module.js:413:34) @ object.module._extensions..js (module.js:422:10) @ module.load (module.js:357:32) @ function.module._load (module.js:314:12) @ module.require (module.js:367:17)
how can include in case underscore, in case other libraries?
[update]
i installed globally underscore lib (node install -g underscore).
i create symbolic link cloud -> < path located cloud/main.js >
next created package.json npm init command
i launch again npm install
i created app.js described in guid , configured using same parameters above.
i started server node app.js
all gone fine. problem right in permissions on create new document, should have grants, problem solve. hope can else
i hit same problem , error message. did followings , works
- npm install underscore
- use path: var _ = require('../node_modules/underscore/underscore.js')
refer more details in post.
Comments
Post a Comment