Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server fails to start [v2] #17

Open
juhamust opened this issue Sep 6, 2018 · 4 comments
Open

Server fails to start [v2] #17

juhamust opened this issue Sep 6, 2018 · 4 comments

Comments

@juhamust
Copy link
Contributor

juhamust commented Sep 6, 2018

item info notes
node version v8.9.0
npm version 5.5.1
mozaik-demo version #61504051511
@mozaik/server version 2.0.0-alpha.7

Expected behavior

Server should start without errors, as documented in http://mozaik.rocks/v2/use/

Actual behavior

For some reason, instance methods are not found:

> using config file: 'conf/config.yml'

/Users/juha/mozaik-demo/server.js:10
Mozaik.configureFromFile(path.join(__dirname, configFile))
       ^

TypeError: Mozaik.configureFromFile is not a function
    at Object.<anonymous> (/Users/juha/mozaik-demo/server.js:10:8)
    at Module._compile (module.js:635:30)
    at Object.Module._extensions..js (module.js:646:10)
    at Module.load (module.js:554:32)
    at tryModuleLoad (module.js:497:12)
    at Function.Module._load (module.js:489:3)
    at Function.Module.runMain (module.js:676:10)
    at startup (bootstrap_node.js:187:16)
    at bootstrap_node.js:608:3

Steps to reproduce

git clone https://github.com/plouc/mozaik-demo.git
cd mozaik-demo
git checkout mozaik-2
npm install
node server.js
@jderusse
Copy link

Fixed it with

// server.js
-const Mozaik = require('@mozaik/server')                                                                                                                     
+const Mozaik = require('@mozaik/server').default           

@plouc
Copy link
Owner

plouc commented Sep 14, 2018

@jderusse, thank you

@dogoepp
Copy link

dogoepp commented Jan 21, 2019

From the latest commit of the v2 branch, I actually have to remove .default to get it to work.

I'm not yet familiar with JS nor Mozaïk so I couldn't understand the reason behind this observation.

@chakibus
Copy link

chakibus commented Jul 19, 2019

From the latest commit of the v2 branch, I actually have to remove .default to get it to work.

I'm not yet familiar with JS nor Mozaïk so I couldn't understand the reason behind this observation.

Me too I had to remove the .default to get it to work otherwise I was facing bellow error:

Server.configureFromFile(path.join(__dirname, configFile))
^

TypeError: Cannot read property 'configureFromFile' of undefined
at Object. (/Users/cmelaika/Projects/dashboard/server.js:10:8)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Function.Module.runMain (module.js:694:10)
at startup (bootstrap_node.js:204:16)
at bootstrap_node.js:625:3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants