Build problems

(Kire Pudsje) #1

I experience build problems on both linux (Opensuse tumbleweed) as Win10. Same error message

starting from a fresh git:
commit a489c392788c6fe56baa5e518b7cf99b055a69d4 (HEAD -> dev-es6, origin/dev-es6, origin/HEAD)
Author: Claudio Prezzi
Date: Sat Mar 2 10:30:44 2019 +0100

npm run install-dev
npm install
npm start

user@linux-z416:~/lw/LaserWeb4> npm start

laserweb@4.0.996 start /home/user/lw/LaserWeb4
npm-run-all -p -r start-app start-server

laserweb@4.0.996 start-app /home/user/lw/LaserWeb4
webpack-dev-server --progress --colors --open

laserweb@4.0.996 start-server /home/user/lw/LaserWeb4
node node_modules/lw.comm-server/server.js

(function (exports, require, module, __filename, __dirname) { require(‘dotenv’).load({silent: true});

TypeError: require(…).load is not a function
at Object. (/home/user/lw/LaserWeb4/node_modules/lw.comm-server/config.js:1:81)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions…js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object. (/home/user/lw/LaserWeb4/node_modules/lw.comm-server/server.js:28:16)
at Module._compile (internal/modules/cjs/loader.js:689:30)
npm ERR! errno 1
npm ERR! laserweb@4.0.996 start-server: node node_modules/lw.comm-server/server.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the laserweb@4.0.996 start-server script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.


(James Rivera) #2

I’ve still pretty new with node/npm, but have you installed ‘dotenv’?

Maybe run: npm install dotenv


(Kire Pudsje) #3

Just to add. If I build the lw.comm-server git itself I see no problems and can start the server. It is the LaserWeb4 git that has the problems.


(Kire Pudsje) #4

Thanks for your answer. It is the first time that I try and play with node.
Unfortunately this did not help. The dotnet was already installed in the node_modules.


(Kire Pudsje) #5

First let me state that I do not have a clue yet about node and its build system.
To get everything working, I replaced in: node_modules/lw.comm-server/config.js, the first line to be: require(‘dotenv’).config()
No idea if this is a proper solutions. But it got me a step further.
Furthermore, I also had to issue the following command
npm install --save object.omit

With these changes, at least I got LW4 running.


(anon57870006) #6

@James_Rivera honestly do we want that our screw drivers operate only when wifi/internet is available ?
I loved tools because you can use them in the wild.
Net connected tool is NOT a tool :stuck_out_tongue:


(Michael K Johnson) #7

@anon57870006 npm install is “going to the store to buy the screwdriver” in your analogy. In any case not clear how snarking about choice of tool is helpful here? This is the LaserWeb category, and if you don’t like it just let it be perhaps.

Possibly @cprezzi is more able to help here, since it’s his commit referenced.


(Claudio Prezzi) #8

@Kire_Pudsje Unfortunately it’s not so easy to get the whole build chain working. Do you realy need to compile LW yourself or would it be an option to just use the precompiled installers?

One of the last changes on lw.comm-server was upgrading node serialport 4.0.7 to 6.2.2, which could potentialy make problems if the frontend still wants to use version 4.

Could you please check the version of serialport (in your node_modules folder and if you also have a different version globaly installed)?

If you was able to run lw.comm-server itself, then you can also try to manually copy that folder to the node_modules forlder in LaserWeb4.

1 Like

(Kire Pudsje) #9

The serialport in my case is 6.2.2
However this is not the problem. I now found that in the dotenv from 2019-03-12 it is mentioned that:

Removed load alias for config for consistency throughout code and documentation.

So my previous fix seems to be a valid one.

BTW, I wanted to compile LW4 myself, since I want to add my dogbone generation code into LW4. If succesfull, I will commit.


(Claudio Prezzi) #10

@Kire_Pudsje Thanks for that hint. I will check and update accordingly.

When I build LW4, I usually first make sure that I can run lw.comm-server (master) and LaserWeb4 (dev-es6) manually and they can connect (via websocket).
Then I build the webpack of LW4 and copy it into the app folder of lw.comm-server. This is the embeded frontend that can be called via webbrowser.
The last step is to merge the changes to the electron_bundler branch and build the electron app.

For all these steps there are scripts in the corresponding package.json files. The script “nightlywindows” in the electron_bundler branch of lw.comm-server shows the whole build chain.

Hope this will help you for building. I would be happy if I had someone who cares about building the installers (as Jorge Robles was responsible for that part and he doesn’t have much time lately).