Problem starting the front-end in dev

Hello,

I tried to update gladys on my machine to « dev » and I get this error when I try to start the front-end:

 Build  [                    ] 0% (0.0s) compiling✖ ERROR TypeError: Cannot read properties of undefined (reading 'get')
✖ ERROR TypeError: Cannot read properties of undefined (reading 'get')
    at /opt/Gladys/front/node_modules/webpack/lib/DefinePlugin.js:313:38
    at SyncHook.eval [as call] (eval at create (/home/jp/.nvm/versions/node/v18.14.0/lib/node_modules/preact-cli/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:29:1)
    at SyncHook.lazyCompileHook (/home/jp/.nvm/versions/node/v18.14.0/lib/node_modules/preact-cli/node_modules/tapable/lib/Hook.js:154:20)
    at Compiler.newCompilation (/home/jp/.nvm/versions/node/v18.14.0/lib/node_modules/preact-cli/node_modules/webpack/lib/Compiler.js:631:26)
    at /home/jp/.nvm/versions/node/v18.14.0/lib/node_modules/preact-cli/node_modules/webpack/lib/Compiler.js:667:29
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/home/jp/.nvm/versions/node/v18.14.0/lib/node_modules/preact-cli/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
    at AsyncSeriesHook.lazyCompileHook (/home/jp/.nvm/versions/node/v18.14.0/lib/node_modules/preact-cli/node_modules/tapable/lib/Hook.js:154:20)
    at Compiler.compile (/home/jp/.nvm/versions/node/v18.14.0/lib/node_modules/preact-cli/node_modules/webpack/lib/Compiler.js:662:28)
    at /home/jp/.nvm/versions/node/v18.14.0/lib/node_modules/preact-cli/node_modules/webpack/lib/Watching.js:77:18
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/home/jp/.nvm/versions/node/v18.14.0/lib/node_modules/preact-cli/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:33:1)
    at AsyncSeriesHook.lazyCompileHook (/home/jp/.nvm/versions/node/v18.14.0/lib/node_modules/preact-cli/node_modules/tapable/lib/Hook.js:154:20)
    at Watching._go (/home/jp/.nvm/versions/node/v18.14.0/lib/node_modules/preact-cli/node_modules/webpack/lib/Watching.js:41:32)
    at /home/jp/.nvm/versions/node/v18.14.0/lib/node_modules/preact-cli/node_modules/webpack/lib/Watching.js:33:9
    at Compiler.readRecords (/home/jp/.nvm/versions/node/v18.14.0/lib/node_modules/preact-cli/node_modules/webpack/lib/Compiler.js:529:11)
    at new Watching (/home/jp/.nvm/versions/node/v18.14.0/lib/node_modules/preact-cli/node_modules/webpack/lib/Watching.js:30:17)
    at Compiler.watch (/home/jp/.nvm/versions/node/v18.14.0/lib/node_modules/preact-cli/node_modules/webpack/lib/Compiler.js:244:10)

Nothing I do works, I can’t get it sorted :cry:

Have you tried deleting your node_modules and reinstalling the dependencies?

Yes.

So I just tried on a brand-new clone, since on my branch I’m bringing in some changes.
On node v18, I get the error related to the option NODE_OPTIONS=--openssl-legacy-provider which doesn’t seem to work properly. Downgrading to node v16 and removing the option

I confirm that we’re on Node 18 everywhere now, frontend and backend.

What error are you getting with the option?

ERROR Error: error:0308010C:digital envelope routines::unsupported

I think I had fixed it, I don’t remember how, before being faced with my other error :confused:

Yes, this error is fixed by NODE_OPTIONS=--openssl-legacy-provider normally, you are on master and your package.json looks like this :

?

yes yes I’ve read the literature on this error, I’m sad ^^

Which OS are you on? I admit I’m on macOS and Linux; I’ve never tested on Windows, so the problem might be there.

Ubuntu 22.04

To start Gladys front, you run npm start in the front folder, right?

Yes, I’m doing that.
Okay, I have to go, I’ll get back to it tonight … Thanks for the quick response :slight_smile:

Hard to help you without more information :stuck_out_tongue:

We do all the builds on CI with Ubuntu 22.04, on Node 18, and it works perfectly (I did

Okay, I moved from node v18.14 to 18.15 — I no longer have openssl or webpack errors.
However, I’m no longer compatible with the npm version.

But I now have an error with the tagify library:

ERROR in ../node_modules/@yaireo/tagify/dist/tagify.min.js 305:13
Module parse failed: Unexpected token (305:13)
File was processed with these loaders:
 * ../node_modules/babel-loader/lib/index.js
 * ../node_modules/source-map-loader/dist/cjs.js
You may need an additional loader to handle the result of these loaders.
|         s = this.dropdown.getHeaderRef(),
|         a = this.dropdown.getFooterRef();
>       e && s?.parentNode.replaceChild(e, s), i && a?.parentNode.replaceChild(i, a);
|     },
|     refilter(t) {

This is strange though, there shouldn’t be any differences across minor versions of Node.js

On my machine I’m on Node v18.16 and it builds on its own.

I just re-tested this morning to be sure:

  • rm -rf node_modules
  • npm install
  • npm start

and everything installs and runs without issue.

How did you install Node

I switched to Node 18.16 and npm to v8 because I was on v9 and had a warning. I tried using Volta; I had been using nvm.
But nothing helps, I still get the error :cry:

Good luck :smiley: It’s hard to help you without any information.

There must be something different in your setup, because on the CI it’s a brand-new Ubuntu 22.04, Node freshly installed, and everything passes

Same locally on my machine…

Same at home, I have 22.04 everywhere and I don’t have the issue.

1 Like

Well I managed to get by without really understanding everything…

I had to add these 2 loaders for Babel:

@babel/plugin-proposal-optional-chaining')
@babel/plugin-proposal-nullish-coalescing-operator')

I also had to force the install of sirv-cli

Yet on my laptop, I confirm that I didn’t have to do that either, it’s only on my server that I had to do that… I don’t get it…

1 Like