Meteor Session is not defined

前端 未结 4 2000
庸人自扰
庸人自扰 2020-12-17 17:15

when I run my meteor project, this problem occurred:

ReferenceError: Session is not defined
at app/_components/talk/views/friends_list.coffee.js:1:16
at /hom         


        
相关标签:
4条回答
  • 2020-12-17 17:47

    While the above is correct, if you are using newer versions of Meteor, Session is no longer supported by default. Stop your server, open terminal and write:

    meteor add session
    

    If you’re looking for ReactiveVar and ReactiveDict, same issue. Open terminal and write:

    meteor add reactive-var reactive-dict 
    
    0 讨论(0)
  • 2020-12-17 17:47

    As per latest Meteor ^1.5.1

    goto .meteor/packages file and add session at the last line.

    NOTE: It does not matter whether your meteor server was UP or NOT.


    Old Answer

    Stop the meteor server and run below command.

    meteor add session
    
    0 讨论(0)
  • 2020-12-17 17:51

    This happend to me after i deployed to DigitalOcean with mupx.

    Session worked when developing on localhost, but after deploying i got ReferenceError: Session is not defined

    Error was fixed after adding session to meteor packages and redeployed.

    0 讨论(0)
  • 2020-12-17 18:03

    This might be happening because Session only works on the client and at app/_components/talk/views/friends_list.coffee.js it would also be run on the server.

    You might want to move all your views/client side stuff into the /client directory or place it in:

    if(Meteor.isClient) {
    
    }
    
    0 讨论(0)
提交回复
热议问题