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

Report more information when a prebuild is not found #54

Open
aminya opened this issue Nov 18, 2022 · 6 comments · May be fixed by #55
Open

Report more information when a prebuild is not found #54

aminya opened this issue Nov 18, 2022 · 6 comments · May be fixed by #55

Comments

@aminya
Copy link

aminya commented Nov 18, 2022

Currently, it is quite hard to understand why a prebuild is not picked up, especially when the log comes from the end user. I think adding a console.log that includes some information like the host's platform, architecture, libc, etc. will help debug the issues.

@vweevers
Copy link
Member

We already do:

node-gyp-build/index.js

Lines 47 to 60 in 0078d78

var target = [
'platform=' + platform,
'arch=' + arch,
'runtime=' + runtime,
'abi=' + abi,
'uv=' + uv,
armv ? 'armv=' + armv : '',
'libc=' + libc,
'node=' + process.versions.node,
process.versions.electron ? 'electron=' + process.versions.electron : '',
typeof __webpack_require__ === 'function' ? 'webpack=true' : '' // eslint-disable-line
].filter(Boolean).join(' ')
throw new Error('No native build was found for ' + target + '\n loaded from: ' + dir + '\n')

@aminya
Copy link
Author

aminya commented Nov 18, 2022

This is not happening when people run npm i. Some examples. See the logs.

zeromq/zeromq.js#526
zeromq/zeromq.js#530 (comment)

@vweevers
Copy link
Member

I would guess because of https://github.com/zeromq/zeromq.js/blob/dd72eed5835e321e5c728959744e08f093557beb/package.json#L73 (the additional steps before node-gyp-build).

@aminya
Copy link
Author

aminya commented Nov 18, 2022

I added those just right now, and it is not released yet. Those reports are older.

@vweevers
Copy link
Member

vweevers commented Nov 18, 2022

OK, may need npm i --verbose then. I don't recall.

@aminya
Copy link
Author

aminya commented Nov 18, 2022

Looking at the code, the code path is not clear to me. A lot of old-style JS dynamism and prototype assignment is used. Using TypeScript could make it easier to find the reason. Where is the call site of the load function?

node-gyp-build/index.js

Lines 18 to 25 in 0078d78

module.exports = load
function load (dir) {
return runtimeRequire(load.path(dir))
}
load.path = function (dir) {

I also see some ignored error variables.

if (err) {

@aminya aminya linked a pull request Nov 18, 2022 that will close this issue
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

Successfully merging a pull request may close this issue.

2 participants