package.json如下:
{
"name": "cloud-lab-wx",
"version": "0.0.1",
"description": "云代码",
"private": true,
"dependencies": {
"amui-hbs-helper": "^2.2.0",
"body-parser": "^1.12.4",
"cookie-parser": "^1.3.5",
"crypto": "0.0.3",
"errorhandler": "^1.3.6",
"express": "^4.12.4",
"hbs": "^3.0.1",
"xml2js": "^0.4.9"
}
}

部署成功了,但是运行时却报
Error: Cannot find module 'hbs'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at new View (/mnt/avos/cloud-code/node_modules/express/lib/view.js:43:49)
at Function.app.render (/mnt/avos/cloud-code/node_modules/express/lib/application.js:488:12)
at ServerResponse.res.render (/mnt/avos/cloud-code/node_modules/express/lib/response.js:798:7)
at Object.handle (cloud_sandbox:[development] cloud/app.js:69:9)
at next (/mnt/avos/cloud-code/node_modules/express/node_modules/connect/lib/proto.js:185:17)
at next (/mnt/avos/cloud-code/node_modules/express/node_modules/connect/lib/proto.js:165:78)

不支持Handlebars?

请在 package.json 里加上handlebars 依赖。handlerbars 不是内置库。

你好,谢谢你的回复
不过加上了handlebars依赖也仍然报错 还是Error: Cannot find module 'hbs'

抱歉没有看清楚。上次我试过在云代码环境使用 handlebars,用的这个模块:https://github.com/ericf/express-handlebars,示例页面:http://leanstartup.avosapps.com/handlebar

express-handlebars是针对express 3的,我现在用的是express 4,另外我要用hbs是因为amui-hbs-helper依赖于它

那你应该用的是新版本的 LeanEngine,LeanEngine 第三方限制很小的,你先调试一下吧……

试了好多次,还是没成功。。。 谢谢你的回复