Comments (15)
theme not found 具体显示的错误是什么呢?可以在本地运行的时候在日志上看到错误堆栈
from candy.
遇到了同样的错误:
Error: template not found
at Theme.render (/home/f1mobi/candy/node_modules/theme/libs/theme.js:68:42)
at /home/f1mobi/candy/routes/page.js:40:17
at Promise. (/home/f1mobi/candy/ctrlers/thread.js:54:11)
at Promise. (/home/f1mobi/candy/node_modules/express-scaffold/node_modules/mongoose/node_modules/mpromise/lib/promise.js:177:8)
at Promise.EventEmitter.emit (events.js:95:17)
at Promise.emit (/home/f1mobi/candy/node_modules/express-scaffold/node_modules/mongoose/node_modules/mpromise/lib/promise.js:84:38)
at Promise.fulfill (/home/f1mobi/candy/node_modules/express-scaffold/node_modules/mongoose/node_modules/mpromise/lib/promise.js:97:20)
at Promise.resolve (/home/f1mobi/candy/node_modules/express-scaffold/node_modules/mongoose/lib/promise.js:108:15)
at Promise. (/home/f1mobi/candy/node_modules/express-scaffold/node_modules/mongoose/node_modules/mpromise/lib/promise.js:177:8)
at Promise.EventEmitter.emit (events.js:95:17)
GET / 500 575ms
GET /candy-theme-flat/images/favicon.ico 304 11ms
GET /candy-theme-flat/stylesheets/duoshuo.css 304 17ms
GET /candy-theme-flat/stylesheets/style.css 200 228ms
GET /candy-theme-flat/stylesheets/bootstrap.min.css 304 7ms
GET /candy-theme-flat/stylesheets/font-awesome.min.css 304 6ms
GET /candy-theme-flat/images/bg.png 304 9ms
GET /candy-theme-flat/images/logo.png 304 13ms
GET /candy-theme-flat/images/candy-mini.png 304 9ms
没有写过node程序 配置的时候遇到好些问题。只好发一个评论问问了。
from candy.
我在控制台打了log:
Theme.prototype.render = function(template, data, callback) {
// 先判断是不是有效的文件名
var pkgname = hub.finder.split(template);
var filename = hub.finder.split(template, 'filename');
console.log('template:' + template);
console.log('pkgname:' + pkgname);
console.log('filename:' + filename);
var cb = (callback && .isFunction(callback)) ? callback : function(){};
if (!pkgname || !filename) return cb(new Error('template not found'));
// 判断是不是 shortname, 这里有一个硬编码,需要把这个功能放到 pkghub 中
if (pkgname.indexOf('-') === -1 && this.meta.name) pkgname = this.meta.name + '-theme-' + pkgname;
// 混合 locals,替代 app.locals 与 res.locals
if (!.isEmpty(this.locals)) data = _.extend(this.locals, data);
return render([pkgname, filename].join('/'), data, cb);
};
输出结果是这样的:
template:/index
pkgname:
filename:index
看起来是无法定位pkgname。
from candy.
@harrylu 这个是 clone 仓库的最新版本还是使用 npm 安装的版本呢?看这个错误日志是你运行的时候找不到首页的 template 了,需要更多的信息才能确定是什么问题。另外,因为 theme 模块中没有暴露具体错误,所以这个错误也可能是渲染模板的时候报错引起的,这个问题会在 theme 的下一个版本中的到解决。所以可能不一定是模板找不到,也可能是模板渲染中出现错误
from candy.
哦我知道是什么问题了,仓库里的不稳定版本依赖了一个没有发布的 0.0.7 theme 版本,我刚发布了 theme 0.0.7 然后你再 npm install theme 一下就好了。
from candy.
谢谢这么晚还回复:-)
- 是git clone的仓库
- 看起来是这样,但是没有更多信息了。具体的log在我上一个comment里。别的没有了。
好的,我马上测试。
from candy.
It works. 谢谢你哎!
from candy.
@harrylu 把 candy 的 theme 依赖升级到 0.0.7 应该就没问题了,因为我周末的时候给 candy 加了一个默认主题的配置,然后把渲染逻辑里的硬编码删掉了,所以你那才会找不到模板。
from candy.
@turingou 已经可以了。这个项目很棒。赶紧睡觉吧,期待candy变得更好用。我是android开发者,否则就一起出力了。
from candy.
我在 /root/.pm2/logs/app-err-1.log
里看到的是:Error: Cannot find module 'npm'
,重复出现了很多次。
from candy.
@hudidit 这是一个很常见的问题。你应该Google "Cannot find module 'npm'" 简单来说,就是无法找到$NODE_PATH。你可以通过echo $NODE_PATH查看。你的应该是空。
from candy.
@harrylu 多谢!NODE_PATH这个问题用你的方法解决了。
你在控制台打log的那段代码写在哪里呢?
from candy.
Error: Cannot find module 'npm' 的问题也可以通过在本地依赖中安装 npm 解决 npm install npm
from candy.
@turingou 谢谢。npm的问题已经解决了,但是 theme not found 的问题还在,请问我应该怎样查找问题原因呢?比如harrylu的打log的方法,那段代码应该写在哪里?多谢指点!
from candy.
- 我打log的地方,你看看这个comment (https://github.com/turingou/candy/issues/34#issuecomment-38386778)。
我忘记是哪个文件里了。你自己找一下看。 - 我最后解决"theme not found" 是用了这个办法: #34 (comment)
from candy.
Related Issues (20)
- 无法启动出错 HOT 1
- 建议发布一个版本之后打上tag HOT 1
- 同500问题,theme not found HOT 3
- 节点可以编辑嘛? HOT 2
- mongodb 开启强制验证会无法连接 HOT 19
- 拉取最新版本之后 npm update ,所有页面都提示 404 HOT 10
- 直接访问 URL/board 会显示 boards 集合的数据 HOT 1
- 尝试部署在BAE3.0 HOT 4
- 删除附件
- 文件缓存时间 HOT 2
- 支持移动话题到某个 Board 下面
- 500错误,Error: 缺少client_id参数 HOT 1
- 安装错误,无法连接localhost:27017 HOT 6
- 安装错误 HOT 2
- 安装成功,但无法运行 HOT 1
- 启动应用时报错 HOT 1
- 东西是好东西啊,但安装好慢啊 HOT 1
- Candy 现在基本瘫痪跑不起来了 HOT 2
- 登录时出错. HOT 13
- 两种方法安装都会报错。。。 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from candy.