Code Monkey home page Code Monkey logo

Comments (38)

guo-yu avatar guo-yu commented on June 11, 2024

部署到生产环境的话在app.js里加一句 app.set('env','production') 默认的是 development , 我忘了在readme里写了,稍后加上~ 抱歉

from candy.

guo-yu avatar guo-yu commented on June 11, 2024

也可以在启动脚本里这样写:

new Server({
    name: 'Candy', // 站点名称
    url: 'http://candy.com', // 站点url
    desc: 'some desc', // 站点描述
    env: 'production',
    database: {
        name: 'candy'
    },
    duoshuo: { 
        short_name: 'candydemo', // 多说 short_name
        secret: '055834753bf452f248602e26221a8345' // 多说 secret
    }
}).run();

from candy.

goxofy avatar goxofy commented on June 11, 2024

哦!明白了,我在app.js里面找要改的地方找不到

from candy.

goxofy avatar goxofy commented on June 11, 2024

你好,改了之后url是正常了,但是跳转之后还是报错,内容

url: http:/abc.3322.org:9999/admin/

TypeError: /home/tink/candy/views/signin.jade:4
    2|     #mime.clearfix.side-cnt
    3|         h3.title 欢迎回来
  > 4|             | , #{user.nickname ? user.nickname : user.duoshuo.user_id}
    5|         - if (user.avatar)
    6|             .avatar_container
    7|                 img(src="#{user.avatar}",alt="#{user.nickname ? user.nickname : user.duoshuo.user_id}",title="#{user.nickname ? user.nickname : user.duoshuo.user_id}").avatar-mini.fn-right

Cannot read property 'user_id' of undefined
    at eval (eval at <anonymous> (/home/tink/candy/node_modules/jade/lib/jade.js:152:8), <anonymous>:349:89)
    at /home/tink/candy/node_modules/jade/lib/jade.js:153:35
    at Object.exports.render (/home/tink/candy/node_modules/jade/lib/jade.js:197:10)
    at Object.exports.renderFile (/home/tink/candy/node_modules/jade/lib/jade.js:233:18)
    at View.exports.renderFile [as engine] (/home/tink/candy/node_modules/jade/lib/jade.js:218:21)
    at View.render (/home/tink/candy/node_modules/express/lib/view.js:76:8)
    at Function.app.render (/home/tink/candy/node_modules/express/lib/application.js:505:10)
    at ServerResponse.res.render (/home/tink/candy/node_modules/express/lib/response.js:756:7)
    at Object.exports.common [as handle] (/home/tink/candy/lib/error.js:29:13)
    at next (/home/tink/candy/node_modules/express/node_modules/connect/lib/proto.js:185:17)

from candy.

guo-yu avatar guo-yu commented on June 11, 2024

看下数据库中新建的用户~ 这可能是和多说通信出了问题,导致没有拿到这个用户在多说的id

from candy.

guo-yu avatar guo-yu commented on June 11, 2024

另外你的candy版本是多少?是npm上的版本吗?我有几个版本没有同步到npm去了

from candy.

goxofy avatar goxofy commented on June 11, 2024

之前的是npm中的,这个是刚刚从git上clone下来的最新版

from candy.

goxofy avatar goxofy commented on June 11, 2024

我不知道怎么看数据库里的东西啊,对mongodb完全不了解。。

from candy.

guo-yu avatar guo-yu commented on June 11, 2024

正在路上,晚上回到住处我clone一份新的看看,可能是我哪里的逻辑有遗漏~

from candy.

goxofy avatar goxofy commented on June 11, 2024

嗯嗯,好的,感谢!

from candy.

guo-yu avatar guo-yu commented on June 11, 2024

@goxofy

使用mongo shell,可以这样操作:

$ mongo
$ use candy
$ db.users.find({}) 

就可以看到users表里的所有用户了

from candy.

goxofy avatar goxofy commented on June 11, 2024

ok,我试试

from candy.

goxofy avatar goxofy commented on June 11, 2024

这是表里的东西
{ "_id" : ObjectId("521b27738e7394d401000001"), "threads" : [ ], "type" : "admin", "created" : ISODate("2013-08-26T10:01:23.500Z"), "__v" : 0 }

你晚上回来看看吧,如果需要我可以把服务器ssh提供给你

from candy.

goxofy avatar goxofy commented on June 11, 2024

你好折腾一天还是没搞定。。麻烦你看下东东

from candy.

guo-yu avatar guo-yu commented on June 11, 2024

忘回了~ 这个是同步出错了,没有拿到你这个admin账户的多说信息。但多说没有返回给我result.error,所以我这里就进入了创建用户的步骤,按道理应该不创建用户的,正在沟通。

你可以修改下routes/sign.js 第48行这里打印一下result出来(console.log(result)),看看多说返回的是什么结果~

from candy.

goxofy avatar goxofy commented on June 11, 2024

现在自从那个报错之后,整个服务相当于跑不起来了,node server.js之后,打开首页直接就是上面的错误

from candy.

guo-yu avatar guo-yu commented on June 11, 2024

是啊,你得把这个用户删掉~

from candy.

guo-yu avatar guo-yu commented on June 11, 2024

或者把seesion清空~

from candy.

goxofy avatar goxofy commented on June 11, 2024

要在数据库里删了?

from candy.

guo-yu avatar guo-yu commented on June 11, 2024

恩,建议你重新把仓库里的代码clone一下,然后再本地跑一个新的candy出来~

from candy.

goxofy avatar goxofy commented on June 11, 2024

我试试

from candy.

goxofy avatar goxofy commented on June 11, 2024

加了console.log(result)跑了一次,输出在哪里查看呀?

from candy.

guo-yu avatar guo-yu commented on June 11, 2024

直接用node
server.js跑,输出可以在你ssh进去的那台机器上打印出来的,如果是0.1.2版本之后的新代码,遇到错误之后输出会在项目目录下的error.log里

在 2013年8月27日星期二,TinK [email protected] 写道:

加了console.log(result)跑了一次,输出在哪里查看呀?


Reply to this email directly or view it on GitHub.<
https://github.com/notifications/beacon/le1rFsPJQp1NmP-0KQPzCc7j11tk72tCL-2mtuqACK-s3XzJ0apKjqyNu0_3jAMy.gif

from candy.

goxofy avatar goxofy commented on June 11, 2024

介是输出。。。你瞅瞅。。。

GET /font/fontawesome-webfont.woff?v=3.2.1 304 6ms
{ code: 2, errorMessage: '缺少code参数' }
GET /signin/?code=ffc7d497131e0bade1461533c6d48153 302 302ms - 70b
error: TypeError: /home/tink/candy/views/signin.jade:4
    2|     #mime.clearfix.side-cnt
    3|         h3.title 欢迎回来
  > 4|             | , #{user.nickname ? user.nickname : user.duoshuo.user_id}
    5|         - if (user.avatar)
    6|             .avatar_container
    7|                 img(src="#{user.avatar}",alt="#{user.nickname ? user.nickname : user.duoshuo.user_id}",title="#{user.nickname ? user.nickname : user.duoshuo.user_id}").avatar-mini.fn-right

Cannot read property 'user_id' of undefined path=/home/tink/candy/views/signin.jade
TypeError: /home/tink/candy/views/signin.jade:4
    2|     #mime.clearfix.side-cnt
    3|         h3.title 欢迎回来
  > 4|             | , #{user.nickname ? user.nickname : user.duoshuo.user_id}
    5|         - if (user.avatar)
    6|             .avatar_container
    7|                 img(src="#{user.avatar}",alt="#{user.nickname ? user.nickname : user.duoshuo.user_id}",title="#{user.nickname ? user.nickname : user.duoshuo.user_id}").avatar-mini.fn-right

Cannot read property 'user_id' of undefined
    at eval (eval at <anonymous> (/home/tink/candy/node_modules/jade/lib/jade.js:152:8), <anonymous>:376:89)
    at /home/tink/candy/node_modules/jade/lib/jade.js:153:35
    at Object.exports.render (/home/tink/candy/node_modules/jade/lib/jade.js:197:10)
    at Object.exports.renderFile (/home/tink/candy/node_modules/jade/lib/jade.js:233:18)
    at View.exports.renderFile [as engine] (/home/tink/candy/node_modules/jade/lib/jade.js:218:21)
    at View.render (/home/tink/candy/node_modules/express/lib/view.js:76:8)
    at Function.app.render (/home/tink/candy/node_modules/express/lib/application.js:505:10)
    at ServerResponse.res.render (/home/tink/candy/node_modules/express/lib/response.js:756:7)
    at Object.exports.common [as handle] (/home/tink/candy/lib/error.js:29:13)
    at next (/home/tink/candy/node_modules/express/node_modules/connect/lib/proto.js:185:17)
GET /admin/ 500 1472ms - 1.36kb

from candy.

goxofy avatar goxofy commented on June 11, 2024

这是errors.log

{"error":{"path":"/home/tink/candy/views/signin.jade"},"level":"error","message":"T    ypeError: /home/tink/candy/views/signin.jade:4\n    2|     #mime.clearfix.side-cnt\    n    3|         h3.title 欢迎回来\n  > 4|             | , #{user.nickname ? user.ni    ckname : user.duoshuo.user_id}\n    5|         - if (user.avatar)\n    6|                 .avatar_container\n    7|                 img(src=\"#{user.avatar}\",alt=\"#{use    r.nickname ? user.nickname : user.duoshuo.user_id}\",title=\"#{user.nickname ? user    .nickname : user.duoshuo.user_id}\").avatar-mini.fn-right\n\nCannot read property '    user_id' of undefined","timestamp":"2013-08-27T08:37:30.691Z"}

from candy.

guo-yu avatar guo-yu commented on June 11, 2024
{ code: 2, errorMessage: '缺少code参数' }
GET /signin/?code=ffc7d497131e0bade1461533c6d48153 302 302ms - 70b

知道是啥问题了~~我之前升级了beer 这个组件,但是忘了改 duoshuo 这个组件中的api,导致code没有正确发送过去,抱歉~ 我现在改一下,改完然后回头你 npm install duoshuo 在项目文件中,重新安装一下这个组件

from candy.

goxofy avatar goxofy commented on June 11, 2024

ok~~~~~

from candy.

guo-yu avatar guo-yu commented on June 11, 2024

好了,已经正常,重新clone一下代码再 npm install 试试看~

from candy.

goxofy avatar goxofy commented on June 11, 2024

成功!

建议你把生产环境的配置也写到readme里头。。。

app.set('env', params.env ? params.env : 'production');

from candy.

guo-yu avatar guo-yu commented on June 11, 2024

恩,正在更新文档,可以在server.js里初始化的时候配置 env~

在 2013年8月27日星期二,TinK [email protected] 写道:

成功!

建议你把生产环境的配置也写到readme里头。。。

app.js

app.set('env', params.env ? params.env : 'production');


Reply to this email directly or view it on GitHub.<
https://github.com/notifications/beacon/le1rFsPJQp1NmP-0KQPzCc7j11tk72tCL-2mtuqACK-s3XzJ0apKjqyNu0_3jAMy.gif

from candy.

goxofy avatar goxofy commented on June 11, 2024

继续提交bug~ clone的最新版,也就是0.16版,用户登录成功之后,点 “我的{site_name}”同步数据,会一直卡到这里,console提示如下:

GET /font/fontawesome-webfont.woff?v=3.2.1 304 12ms
GET /member/52231cd8f9856e241b000002 200 568ms - 3.34kb
error: Error: 多说用户同步失败,请稍后再试,详细错误:undefined 
POST /user/sync 500 1006ms - 36b

@turingou

from candy.

guo-yu avatar guo-yu commented on June 11, 2024

@goxofy 可在routes/user.js 91行之后将多说返回的result打印出来看看,是多说返回的什么错误~

from candy.

goxofy avatar goxofy commented on June 11, 2024

1

from candy.

guo-yu avatar guo-yu commented on June 11, 2024

这个返回是正确的,是我提交到这个版本的时候有一个错误,稍等。

from candy.

guo-yu avatar guo-yu commented on June 11, 2024

好了,已经修复~

from candy.

goxofy avatar goxofy commented on June 11, 2024

赞!另外我在想一个问题,假如我想用nginx反代 localhost:9999 来跑这个程序,需要对源代码改造什么吗?比如当我访问 http://abc.com/bbs 的时候,nginx可以将 /bbs/ 反代到nodejs的9999端口这样。。

ps: 还有一个小bug,似乎每次新用户从多说同步数据之后,会将多说那边的用户头像重置为默认的蓝底那个头像,同时同步过来的也是这个头像,而且手动在多说那边设置个人新头像之后,这边不能更新,假如再次点击同步多说数据,又会将多说那边的头像重置掉。。

from candy.

guo-yu avatar guo-yu commented on June 11, 2024

不需要的~但是需要在server.js 启动脚本里把 env 设置成生产环境 production

from candy.

guo-yu avatar guo-yu commented on June 11, 2024

头像的问题我看看~

from candy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.