mozaik-demo
mozaik-demo copied to clipboard
Server fails to start [v2]
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
Fixed it with
// server.js
-const Mozaik = require('@mozaik/server')
+const Mozaik = require('@mozaik/server').default
@jderusse, thank you
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.
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.