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

Package installation requires cmake binary #69

Closed
ghost opened this issue Jan 12, 2022 · 7 comments · Fixed by #77
Closed

Package installation requires cmake binary #69

ghost opened this issue Jan 12, 2022 · 7 comments · Fixed by #77
Labels
bug Something isn't working

Comments

@ghost
Copy link

ghost commented Jan 12, 2022

Checklist

  • [ x] I have read Caveats documentation and didn't find a solution for this problem there.

Bug description

A dependency requires aws-crt, which in turn requires cmake-js, which requires a local cmake installation. Which together makes this package harder to sell to the rest of the team.

Could you please list this requirement in the Install doc?

Relevant output from npm install -D aws-sdk-client-mock -ddd (/path/to/project replaces sensitive information):

npm ERR! path /path/to/project/node_modules/aws-crt
npm ERR! command failed
npm ERR! command sh -c node ./scripts/install.js
npm ERR! info TOOL Using Unix Makefiles generator.
npm ERR! info TOOL Building only the install target, as specified from the command line.
npm ERR! ERR! OMG CMake executable is not found. Please use your system's package manager to install it, or you can get installers from there: http://cmake.org.
npm ERR! /path/to/project/node_modules/cmake-js/lib/cMake.js:117
npm ERR!         throw new Error("CMake executable is not found. Please use your system's package manager to install it, or you can get installers from there: http://cmake.org.");
npm ERR!               ^
npm ERR!
npm ERR! Error: CMake executable is not found. Please use your system's package manager to install it, or you can get installers from there: http://cmake.org.
npm ERR!     at CMake.verifyIfAvailable (/path/to/project/node_modules/cmake-js/lib/cMake.js:117:15)
npm ERR!     at CMake.build (/path/to/project/node_modules/cmake-js/lib/cMake.js:287:10)
npm ERR!     at BuildSystem._invokeCMake (/path/to/project/node_modules/cmake-js/lib/buildSystem.js:70:40)
npm ERR!     at async buildFromRemoteSource (/path/to/project/node_modules/aws-crt/scripts/build.js:148:5)

Environment

  • Node version: v16.13.0
  • Testing lib and version: [email protected]
  • Typescript version: 4.4.3
  • AWS SDK v3 Client mock version: 0.5.6, presumably
  • AWS JS SDK libs and versions:
    • @aws-sdk/client-sqs: 3.43.0
  • Platform: macOS 12.1, Apple M1 Pro chipset
@ghost ghost added the bug Something isn't working label Jan 12, 2022
@prince3339
Copy link

I'm also facing this issue. I recently switched to Macbook M1 Pro and now my app breaks. I used to be fine on my Intel MacBook Pro though.

@prince3339
Copy link

image

@m-radzikowski
Copy link
Owner

Full explanation

To enable mocking for @aws-sdk/lib-storage the library has a peer dependency on @aws-sdk/client-s3, which has an (indirect) peer dependency on aws-crt. The idea was that users that need lib-storage mocks have client-s3 installed anyway, and others will not be affected.

However, NPM from version 7 installs the peer dependencies automatically. So NPM users will have @aws-sdk/client-s3 and aws-crt installed. This is a pretty big issue with AWS SDK v3 itself too: aws/aws-sdk-js-v3#2750, aws/aws-sdk-js-v3#2822

Now, the best long-term solution is to remove the @aws-sdk/client-s3 dependency from this library, as it also causes other problems thanks to the new NPM behavior (#56).

To still provide support for mocking lib-storage and similar, but not require all users to have client-s3 installed, I need to move those mocks definitions out from the main package index.ts. I did implement it (#57), but to use it, package.json exports is required in test libraries like jest. It will be released in the next version, v28. Until then, I can't merge changes.

So right now, when using NPM, you will get aws-crt installed. And aws-crt requires cmake installed locally (#3137).

TL;DR

If you are using NPM to install packages, you need to have cmake installed locally. brew install cmake should do the trick on macOS, also on Macbooks M1.

In the future, after jest v28 release with package exports support, I will remove the dependencies on @aws-sdk/* libs, but it will require using jest v28 or higher, or package exports support in other testing frameworks.

For now, I will update the installation info to include cmake requirement in the README, as @TonyPapousekLC suggested, and close this issue. Feel free to write here if it does not solve the problem, and I will reopen.

@ghost
Copy link
Author

ghost commented Feb 11, 2022

I appreciate the detailed response, that makes sense.

@Antonio-Riccelli
Copy link

@m-radzikowski To confirm, Jest is currently on version 29 - is cmake then no longer required?
Many thanks.

@m-radzikowski
Copy link
Owner

@Antonio-Riccelli no, it's not since v1.0.0.

@VityaSchel
Copy link

I like how emotional and passive agressive this error is.

npm ERR! 😡 ERR! 🤬🤬🤬 OMG ❗️😦😨 CMake executable is not found. 😤

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants