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

TS: yarn install freezes the system | typescript #509

Closed
Revantark opened this issue Jan 30, 2023 · 12 comments
Closed

TS: yarn install freezes the system | typescript #509

Revantark opened this issue Jan 30, 2023 · 12 comments
Assignees
Labels
🔌 typescript TypeScript library

Comments

@Revantark
Copy link

Revantark commented Jan 30, 2023

Trying to integrate tbtc-v2.ts in my project, but when i do
yarn install
after a while, the system freezes.

It is happening in the postInstall script npm rebuild

To reproduce :

  1. clone tbtc-v2 repo;
  2. cd typescript
  3. run yarn install

this just hangs forever

@pdyraga
Copy link
Member

pdyraga commented Jan 30, 2023

What is the Node and Yarn version you are using? Please check the build prerequisites section in the docs.

@Revantark
Copy link
Author

Revantark commented Jan 30, 2023

What is the Node and Yarn version you are using? Please check the build prerequisites section in the docs.
@pdyraga
Node : v18.12.1
yarn: v1.22.19

@lukasz-zimnoch
Copy link
Member

@Revantark, thanks for reporting! The problem you observed sometimes happens when using Node versions greater than 14. We need to investigate it and develop a solution. As a short-term workaround, I recommend you use Node 14. Sorry for the inconvenience!

@Revantark
Copy link
Author

Revantark commented Jan 30, 2023

@lukasz-zimnoch

node-gyp rebuild fails on bcrypto package.

Using node 14

@lukasz-zimnoch
Copy link
Member

@Revantark, please make sure you have all OS-specific prerequisites of node-gyp listed here: https://github.com/nodejs/node-gyp#installation

@Revantark
Copy link
Author

@Revantark, please make sure you have all OS-specific prerequisites of node-gyp listed here: https://github.com/nodejs/node-gyp#installation

@lukasz-zimnoch
I build the package successfully thanks.

But when using it in a project, I'm getting this error
Cannot find module 'bcrypto.node' from tbtc-v2.ts

I'm using yarn to link the local package to a project.

@lukasz-zimnoch
Copy link
Member

@Revantark please try doing npm rebuild in your project just after you install all dependencies with yarn install.

@Revantark
Copy link
Author

Revantark commented Jan 31, 2023

@lukasz-zimnoch Yes, I was doing it. But still i get Cannot find module 'bcrypto.node' error in a node project.

How to reproduce :

yarn: 1.22.19
node: v14

  1. create an empty node project using npm init
  2. run npm install @keep-network/tbtc-v2.ts
  3. run npm rebuild
  4. create a file called app.js and add the below code const tbtc = require('@keep-network/tbtc-v2.ts');
  5. run npm start which runs app.js

Error: Cannot find module 'bcrypto.node'

nkuba added a commit that referenced this issue Feb 2, 2023
In 0e1f624 we added a requirement to
rebuild on postinstall. In this commit we make it explicit that we need
to rebuild bcrypto.

Also the rebuild works only on node 14, which is confusing (see:
#509) so we update engines
to be explicit that node 14 is required.
pdyraga added a commit that referenced this issue Feb 2, 2023
In 0e1f624 we added a requirement to
rebuild on postinstall. In this commit we make it explicit that we need
to rebuild bcrypto.

Also the rebuild works only on node 14, which is confusing (see:
#509) so we update engines
to be explicit that node 14 is required.
@pdyraga
Copy link
Member

pdyraga commented Mar 10, 2023

@lukasz-zimnoch In which places do we need bcrypto in tbtc-v2.ts? In the worst case, we can copy only the code needed.

@lukasz-zimnoch
Copy link
Member

@lukasz-zimnoch In which places do we need bcrypto in tbtc-v2.ts? In the worst case, we can copy only the code needed.

All hash computations. Copying is not an option as this is native code that must be compiled for specific targets.

@Shadowfiend
Copy link
Contributor

bcrypto generally provides (slower) alternatives for the browser--perhaps we can copy and lean on those, if available in this case?

@lukasz-zimnoch
Copy link
Member

We are working on removing the problematic bcrypto and bcoin dependencies. Once done, the problem described here will be solved as well. Closing this issue in favor of #695

@lukasz-zimnoch lukasz-zimnoch added the 🔌 typescript TypeScript library label Sep 18, 2023
@lukasz-zimnoch lukasz-zimnoch added this to the typescript/v1.4.0 milestone Oct 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔌 typescript TypeScript library
Projects
None yet
Development

No branches or pull requests

5 participants