Closed alexellis closed 4 years ago
It looks like on this line, the name
should be changed to binaryName
https://github.com/openfaas/faas-cli/blob/master/npm/install.js#L20
Which instance of "name"?
let release = releases.find(release => release.name === name);
Current line:
let release = releases.find(release => release.name === name);
should be:
let release = releases.find(release => release.name === binaryName);
How did the unit tests pass if this is not right?
I get the same error (404) after the patch
[alex@nuc tmp]$ npm install @openfaas/faas-cli
> @openfaas/faas-cli@0.11.3-1 postinstall /tmp/node_modules/@openfaas/faas-cli
> node -e 'require("./install.js").init()'
Download failed! Request failed with status code 404
npm WARN enoent ENOENT: no such file or directory, open '/tmp/package.json'
npm WARN tmp No description
npm WARN tmp No repository field.
npm WARN tmp No README data
npm WARN tmp No license field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @openfaas/faas-cli@0.11.3-1 postinstall: `node -e 'require("./install.js").init()'`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @openfaas/faas-cli@0.11.3-1 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/alex/.npm/_logs/2019-12-19T14_12_38_941Z-debug.log
Not sure why we get the releases then iterate? Without authentication this can fail and use up the GitHub API rate-limit. We can just run HEAD against the latest release HTML page and read the result. We do this for getting kubeseal and in the get.sh script.
I see. There's a problem with the packaging.
no such file or directory, open '/tmp/package.json'
Part of the install process is to read the package.json file from the local directory. It's one thing to know that it works with the repository (faas-cli) cloned locally and running the script, it's another to ensure that the package is created and shared properly.
If @doowb doesn't get to it first, I will take care of this over weekend.
The testing will need to include publish
and install
, and not limited to run running the script.
Can you migrate the test to use mocha please?
https://mochajs.org/#getting-started
I've made a fix for the time being and re-published. It also uses the HTML page now instead of the API which is rate-limited.
@alexellis not sure if there was still an issue with the actual installation after your fix. I did try it on my system, and it worked perfectly. That said, I did update the tests to use the Mocha library on PR #743 for your review.
Expected Behaviour
This should work:
Current Behaviour
Possible Solution
@burtonr @doowb can you look at the changes made in https://github.com/openfaas/faas-cli/pull/723 and suggest a fix please?