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

Application stop at "Loading Node-RED" when running from dist. #17

Open
eriklindstein opened this issue Aug 30, 2021 · 7 comments
Open

Comments

@eriklindstein
Copy link

eriklindstein commented Aug 30, 2021

If i run the exe created from yarn && yarn dist i get the application window but nothing more. It stops at "Loading Node-RED" i can activate the menu with ALT but see nothing in the console etc.

If i run the application with "yarn start" it works fine.
I looked with netstat and see no open port ( I fixed it at 18880 ) if i run it from dist.

I didn't change anything from the example in the readme.

Here is a similar error that have a fix, but i'm not smart enough to implement all that and make a pull request.
sakazuki/node-red-desktop#49

Here are output from console:
C:\Users\eriklindstein\projects\electron-node-red\dist\win-unpacked>"Node-RED Electron.exe"

C:\Users\eriklindstein\projects\electron-node-red\dist\win-unpacked>
Starting
ARG [
'C:\Users\eriklindstein\projects\electron-node-red\dist\win-unpacked\Node-RED Electron.exe'
]
Store C:\Users\eriklindstein\AppData\Roaming\electron_node_red
FlowFile : C:\Users\eriklindstein.node-red\electronflow.json
(node:9316) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'withFileTypes' of null
at e.readdir (electron/js2c/asar_bundle.js:5:9862)
at go$readdir (C:\Users\eriklindstein\projects\electron-node-red\dist\win-unpacked\resources\app.asar\node_modules\graceful-fs\graceful-fs.js:201:14)
at Object.readdir (C:\Users\eriklindstein\projects\electron-node-red\dist\win-unpacked\resources\app.asar\node_modules\graceful-fs\graceful-fs.js:198:12)
at Object.readdir (C:\Users\eriklindstein\projects\electron-node-red\dist\win-unpacked\resources\app.asar\node_modules\universalify\index.js:5:57)
at C:\Users\eriklindstein\projects\electron-node-red\dist\win-unpacked\resources\app.asar\node_modules@node-red\util\lib\i18n.js:53:16
at new Promise ()
at C:\Users\eriklindstein\projects\electron-node-red\dist\win-unpacked\resources\app.asar\node_modules@node-red\util\lib\i18n.js:51:16
(Use Node-RED Electron --trace-warnings ... to show where the warning was created)
(node:9316) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:9316) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Any ideas?

@eriklindstein
Copy link
Author

I copied the "patch/i18n.js" from sakazuki into "node_modules/@node-red/util/lib/i18n.js" and then it works.

@dceejay
Copy link
Owner

dceejay commented Sep 6, 2021

before or after install ?
IE did you modify the build so it was included correctly ? or just patch it afterwards ?

@eriklindstein
Copy link
Author

Sorry, i just overwrite the file after yarn and before yarn dist

@eriklindstein
Copy link
Author

eriklindstein commented Sep 7, 2021

Some extra info is that I still get the same console error message but it runs and i get the dashboard..

FlowFile : electronflow.json (node:15264) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'withFileTypes' of null at e.readdir (electron/js2c/asar_bundle.js:5:9862) at go$readdir (C:\Users\eriklindstein\projects\electron-node-red\dist\win-unpacked\resources\app.asar\node_modules\graceful-fs\graceful-fs.js:201:14) at Object.readdir (C:\Users\eriklindstein\projects\electron-node-red\dist\win-unpacked\resources\app.asar\node_modules\graceful-fs\graceful-fs.js:198:12) at C:\Users\eriklindstein\projects\electron-node-red\dist\win-unpacked\resources\app.asar\node_modules\universalify\index.js:10:14 at new Promise (<anonymous>) at Object.readdir (C:\Users\eriklindstein\projects\electron-node-red\dist\win-unpacked\resources\app.asar\node_modules\universalify\index.js:7:14) at getFlowsFromPath (C:\Users\eriklindstein\projects\electron-node-red\dist\win-unpacked\resources\app.asar\node_modules\@node-red\registry\lib\library.js:28:15) at Object.addNodeExamplesDir [as addExamplesDir] (C:\Users\eriklindstein\projects\electron-node-red\dist\win-unpacked\resources\app.asar\node_modules\@node-red\registry\lib\library.js:60:12) at Object.addModule (C:\Users\eriklindstein\projects\electron-node-red\dist\win-unpacked\resources\app.asar\node_modules\@node-red\registry\lib\registry.js:220:17) at C:\Users\eriklindstein\projects\electron-node-red\dist\win-unpacked\resources\app.asar\node_modules\@node-red\registry\lib\loader.js:153:34 (Use --trace-warnings ...to show where the warning was created) (node:15264) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag--unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2) (node:15264) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

@dceejay
Copy link
Owner

dceejay commented Sep 10, 2021

Right - so the proper fix for this is to fix that (and other) files in the core of Node-RED (shame @sakazuki didn't think to raise an Issue/PR on the main project) - I've started to do that here - node-red/node-red#3139 - so it will need to be merged and a new core released before we can close this properly.

@sakazuki
Copy link

@dceejay
Thank you for drafting the PR. In my investigation, I suspect that it may be a bug in asar, because when I unzip the asar file that causes the error, it works correctly. However, since I could not find any similar reports, I suspect that the problem may occur in rare cases, such as when Electron replaces the fs module.
So I wasn't planning to make a pull request as there are multiple places in Node-RED core that use fs-extra, but I'd be happy if this PR could be fixed.

@dceejay
Copy link
Owner

dceejay commented Sep 10, 2021

Indeed - it could/should probably be fixed in asar - I guess it probably to do with the way they access into the packed file. But yes we do want to reduce/remove our reliance on fs-extra as we mainly introduced it ages ago because .promises didn't exist is fs at that time (though there are some extra utilities it still offers so we need to be careful), so we will start to work our way through them with this PR.

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

3 participants