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

npm install @think-it-labs/edc-connector-client is busted for v0.4.1 #226

Closed
1 task done
fdionisi opened this issue May 13, 2024 · 2 comments · Fixed by #227
Closed
1 task done

npm install @think-it-labs/edc-connector-client is busted for v0.4.1 #226

fdionisi opened this issue May 13, 2024 · 2 comments · Fixed by #227
Assignees
Labels
bug Something isn't working triage Newly created issue that needs maintainers validation

Comments

@fdionisi
Copy link
Member

Check for existing issues

  • Completed

Describe the bug

The addition of postinstall script (#218) causes the module to fail installation as a client library. That's due to the missing postinstall/edc-openapi.js which is never uploaded to the npm registry.

Provide steps to reproduce it

mkdir ~/temp
cd ~/temp
npm init -y
npm install @think-it-labs/edc-connector-client
# 💥

Output

npm ERR! code 1
npm ERR! path /Users/federico/temp/node_modules/@think-it-labs/edc-connector-client
npm ERR! command failed
npm ERR! command sh -c node postinstall/edc-openapi.js
npm ERR! node:internal/modules/cjs/loader:1080
npm ERR!   throw err;
npm ERR!   ^
npm ERR!
npm ERR! Error: Cannot find module '/Users/federico/temp/node_modules/@think-it-labs/edc-connector-client/postinstall/edc-openapi.js'
npm ERR!     at Module._resolveFilename (node:internal/modules/cjs/loader:1077:15)
npm ERR!     at Module._load (node:internal/modules/cjs/loader:922:27)
npm ERR!     at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:86:12)
npm ERR!     at node:internal/main/run_main_module:23:47 {
npm ERR!   code: 'MODULE_NOT_FOUND',
npm ERR!   requireStack: []
npm ERR! }
npm ERR!
npm ERR! Node.js v18.18.2

npm ERR! A complete log of this run can be found in: /Users/federico/.npm/_logs/2024-05-13T20_10_18_653Z-debug-0.log

If applicable, explain your vision on how this issue should be fixed

I don't think we should rely on postinstall for downloading the EDC OpenAPI specification - there shouldn't be any need to do so every time we install (or initialise) the module into a project.

I'd suggest to to have an explicit script (e.g., download-edc-openapi) which is programmatically called only when necessary (npm run download-edc-openapi or yarn download-edc-openapi).

@fdionisi fdionisi added bug Something isn't working triage Newly created issue that needs maintainers validation labels May 13, 2024
@ndr-brt
Copy link
Contributor

ndr-brt commented May 14, 2024

that's interesting, I thought it was something only related to install for development, not for "production use", for which that script is definitely not needed.

I'm looking at the docs and indeed looks there's no out-of-the-box solution 😮

At this point I'd move the script execution in the pretest step, it's a pity because it gets executed everytime we run yarn test, it will give a better dev experience than a manual script to be run

EDIT: super-question, if I install a library, will all the devDependencies be downloaded as well? if so, that's not great 🥲

@fdionisi
Copy link
Member Author

super-question, if I install a library, will all the devDependencies be downloaded as well? if so, that's not great

If I remember correctly devDependencies should only be downloaded for development purposes; npm install somepackage should only consider downloading direct dependencies. That should be the point of the separation 👀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage Newly created issue that needs maintainers validation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants