npm run build failing
Closed this issue · 14 comments
Environment
- OS: Pop!_OS 22.04
- nody-greeter version: well ...
Bug description
Trying to do anything with nody-greeter in the terminal outputs this:
A JavaScript error occurred in the main process
Uncaught Exception:
Error: Cannot find module 'yargs'
Require stack:
- /opt/nody-greeter/resources/app.asar/js/index.js
-
at Module._resolveFilename (node:internal/modules/cjs/loader:940:15)
at Function.n._resolveFilename (node:electron/js2c/browser_init:249:1128)
at Module._load (node:internal/modules/cjs/loader:785:27)
at Function.c._load (node:electron/js2c/asar_bundle:5:13331)
at Module.require (node:internal/modules/cjs/loader:1012:19)
at require (node:internal/modules/cjs/helpers:94:18)
at Object.<anonymous> (/opt/nody-greeter/resources/app.asar/js/index.js:30:33)
at Module._compile (node:internal/modules/cjs/loader:1116:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1169:10)
at Module.load (node:internal/modules/cjs/loader:988:32)
Steps to reproduce
Installed by building myself as describes in this repo
Literally no idea whats happening
node -v: v16.17.0
npm -v: 8.15.0
Noticed this when trying to run npm run build
╰─ npm run build
> nody-greeter@1.5.1 build
> npm run build:tsc && node make build
> nody-greeter@1.5.1 build:tsc
> tsc --build && npm run build:themes
> nody-greeter@1.5.1 build:themes
> npm run build:theme:gruvbox && npm run build:theme:dracula
> nody-greeter@1.5.1 build:theme:gruvbox
> tsc --build themes/themes/gruvbox
> nody-greeter@1.5.1 build:theme:dracula
> tsc --build themes/themes/dracula
Building with prefix: /usr
Bindings copied
✔ Bindings compiled succesfully
Resources copied
Installing packages with 'npm ci --production -s'
Error: Command failed: npm ci --production -s
at checkExecSyncError (node:child_process:871:11)
at Object.execSync (node:child_process:943:15)
at create_build (/home/crylia/nody-greeter/build.js:157:19)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async build (/home/crylia/nody-greeter/build.js:352:3) {
status: 1,
signal: null,
output: [ null, null, null ],
pid: 135427,
stdout: null,
stderr: null
}
Node-gtk binding for electron found!
Binding copied
INSTALL_ROOT (build/unpacked) prepared
Creating 'asar' package in '/home/crylia/nody-greeter/build/unpacked/opt/nody-greeter/resources/app.asar'
✔ "asar" package created
SUCCESS!
I also switched to a different nodejs version for this one to rule that out (v18.9.0 and 8.19.1 for npm)
Ah, this happens sometimes when re-building, but it's unusual. Just delete everything inside build/nody-asar
and try again.
I did it now a few times and also recloned but I'm still getting this error after npm run build
:
✔ Bindings compiled succesfully
Resources copied
Installing packages with 'npm ci --production -s'
Packages installed
Node-gtk binding for electron found!
Binding copied
INSTALL_ROOT (build/unpacked) prepared
Creating 'asar' package in '/home/crylia/nody-greeter/build/unpacked/opt/nody-greeter/resources/app.asar'
⠦ Creating package.../home/crylia/nody-greeter/node_modules/asar/lib/filesystem.js:101
throw new Error(`${p}: file "${link}" links out of the package`)
^
Error: /home/crylia/nody-greeter/build/nody-asar/node_modules/node-gtk/build/node_gyp_bins/python3: file "../../../../../usr/bin/python3.10" links out of the package
at Filesystem.insertLink (/home/crylia/nody-greeter/node_modules/asar/lib/filesystem.js:101:13)
at handleFile (/home/crylia/nody-greeter/node_modules/asar/lib/asar.js:132:20)
at next (/home/crylia/nody-greeter/node_modules/asar/lib/asar.js:148:11)
at next (/home/crylia/nody-greeter/node_modules/asar/lib/asar.js:149:12)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async build_asar (/home/crylia/nody-greeter/build.js:345:3)
at async build (/home/crylia/nody-greeter/build.js:355:3)
Node.js v18.9.0
That is an error from node-gyp-bins, related to #29. I have yet to find a solution for it.
I'm getting the same error message:
✔ Bindings compiled succesfully
Resources copied
Installing packages with 'npm ci --production -s'
Packages installed
Node-gtk binding for electron found!
Binding copied
INSTALL_ROOT (build/unpacked) prepared
Creating 'asar' package in '/home/jack/code/nody-greeter/build/unpacked/opt/nody-greeter/resources/app.asar'
⠴ Creating package.../home/jack/code/nody-greeter/node_modules/asar/lib/filesystem.js:101
throw new Error(`${p}: file "${link}" links out of the package`)
^
Error: /home/jack/code/nody-greeter/build/nody-asar/node_modules/node-gtk/build/node_gyp_bins/python3: file "../../../../../../usr/bin/python3.10" links out of the package
at Filesystem.insertLink (/home/jack/code/nody-greeter/node_modules/asar/lib/filesystem.js:101:13)
at handleFile (/home/jack/code/nody-greeter/node_modules/asar/lib/asar.js:132:20)
at next (/home/jack/code/nody-greeter/node_modules/asar/lib/asar.js:148:11)
at next (/home/jack/code/nody-greeter/node_modules/asar/lib/asar.js:149:12)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async build_asar (/home/jack/code/nody-greeter/build.js:345:3)
at async build (/home/jack/code/nody-greeter/build.js:355:3)
Node.js v18.12.1
node -v: v18.12.1
npm -v: 9.2.0
Is there any known resolution for this yet?
I was able to build successfully on the latest commit, I haven't tested it yet though
Can confirm that it now works correctly when I run with --debug
, however I'm having an unrelated issue where it refuses to run as root without --no-sandbox
and I'm not sure how I can pass that option to the greeter through the lightdm.conf file.
You can't run a browser, at least a chromium one, with root privilegies without adding the --no-sandbox
flag. So, the same happens with web-greeter/nody-greeter.
Though, you don't need to add this flag in any config file as LightDM will run the greeter with its own user that doesn't have root privilegies. Hence, that "issue" should never occur in a real LightDM environment.
My LightDM seems to try to run it as root, I get the following message in /var/log/lightdm/seat0-greeter.log
[1223/112240.943023:FATAL:electron_main_delegate.cc(290)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.
So maybe my LightDM is not configured right
Which distro u using?
Gentoo, I fixed it now, I had to enable the non-root
USE flag. But now it is all working fine!
Oh, nais!