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

lng dev is not working with latest node version #253

Open
sthirumurugesan opened this issue Jan 31, 2024 · 1 comment
Open

lng dev is not working with latest node version #253

sthirumurugesan opened this issue Jan 31, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@sthirumurugesan
Copy link

I'm using the latest node version and when i try to run the lightning app, I'm getting the below error.

When i use the node version v21.6.1 (latest) issue is observed. When i downgrade to v20.11.0 issue is not observed and everything works fine.

> cross-env LNG_SERVE_OPEN=false LNG_BUILD_SOURCEMAP=true LNG_LIVE_RELOAD=true LNG_LIVE_RELOAD_PORT=8991 LNG_SERVE_PORT=12169 lng dev

 
✔ Testing internet connection..
 
✔ Verifying if your installation of Lightning-CLI is up to date.
 
✔ Removing "build" folder
 
✔ Ensuring "build" folder exists
 
✔ Copying support files to "build"
 
✔ Copying static assets to "build"
 
✔ Copying settings.json to "build"
 
✔ Copying metadata.json to "build"
 
✔ Building ES6 appBundle and saving to build
Starting up http-server, serving ./build

http-server version: 14.1.1

http-server settings: 
CORS: disabled
Cache: -1 seconds
Connection Timeout: 120 seconds
Directory Listings: visible
AutoIndex: visible
Serve GZIP Files: false
Serve Brotli Files: false
Default File Extension: none

Available on:
  http://127.0.0.1:12169/
  http://10.0.0.33:12169/
Hit CTRL-C to stop the server
/usr/local/lib/node_modules/@lightningjs/cli/src/actions/serve.js:74
              .match(/(http|https):\/\/(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}):(\d+)/)[0]
                                                                                   ^

TypeError: Cannot read properties of null (reading '0')
    at Socket.<anonymous> (/usr/local/lib/node_modules/@lightningjs/cli/src/actions/serve.js:74:84)
    at Socket.emit (node:events:531:35)
    at addChunk (node:internal/streams/readable:559:12)
    at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
    at Readable.push (node:internal/streams/readable:390:5)
    at Pipe.onStreamRead (node:internal/stream_base_commons:190:23)

Node.js v21.6.1
@sthirumurugesan sthirumurugesan changed the title Lng Serve is not working with latest node version lng dev is not working with latest node version Jan 31, 2024
@uguraslan
Copy link
Contributor

uguraslan commented Feb 2, 2024

Hey @sthirumurugesan, thanks for bringing this to our attention. I have tested this by using Node v21.6.1 on Linux and I could reproduce the issue. But the problem does not occur every time I run :

cross-env LNG_SERVE_OPEN=false LNG_BUILD_SOURCEMAP=true LNG_LIVE_RELOAD=true LNG_LIVE_RELOAD_PORT=8991 LNG_SERVE_PORT=12169 lng dev

Instead it happens at random times. And I am not sure yet if it is related to the version of Node.

The source of the problem is that data passed to the following if block does not have the IP address(es) of the dev server. I captured the data when the problem occurred and it was like this:

 Hit CTRL-C to stop the server

So we need to check if why sometimes the dev server can't log the IP addresses (or can't get it) and maybe we should also check if the regex matches serve.js:74.

We will be looking into that.

During my tests I added a console.log() to the line right after the if statement:

console.log(`\n#### ${data.toString()} ####\n`)

So, as a reference, I am adding the output I got when the error occurred:

# cross-env LNG_SERVE_OPEN=false LNG_BUILD_SOURCEMAP=true LNG_LIVE_RELOAD=true LNG_LIVE_RELOAD_PORT=8991 LNG_SERVE_PORT=12169 lng dev

✔ Testing internet connection..

✔ Verifying if your installation of Lightning-CLI is up to date.

✔ Removing "build" folder

✔ Ensuring "build" folder exists

✔ Copying support files to "build"

✔ Copying static assets to "build"

✔ Copying settings.json to "build"

✔ Copying metadata.json to "build"

✔ Building ES6 appBundle and saving to build
Starting up http-server, serving ./build

http-server version: 14.1.1

http-server settings:
CORS: disabled
Cache: -1 seconds
Connection Timeout: 120 seconds
Directory Listings: visible
AutoIndex: visible
Serve GZIP Files: false
Serve Brotli Files: false
Default File Extension: none

Available on:
  http://127.0.0.1:12169
  http://172.17.0.2:12169
Hit CTRL-C to stop the server

#### Hit CTRL-C to stop the server
 ####

/usr/local/lib/node_modules/@lightningjs/cli/src/actions/serve.js:75
              .match(/(http|https):\/\/(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}):(\d+)/)[0]
                                                                                   ^

TypeError: Cannot read properties of null (reading '0')
    at Socket.<anonymous> (/usr/local/lib/node_modules/@lightningjs/cli/src/actions/serve.js:75:84)
    at Socket.emit (node:events:531:35)
    at addChunk (node:internal/streams/readable:559:12)
    at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
    at Readable.push (node:internal/streams/readable:390:5)
    at Pipe.onStreamRead (node:internal/stream_base_commons:190:23)

Node.js v21.6.1

@uguraslan uguraslan added the bug Something isn't working label Feb 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants