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

fix macos build: update ipfs dependency to v0.50.2 #612

Merged
merged 4 commits into from Feb 18, 2021

Conversation

yusefnapora
Copy link
Collaborator

I wasn't able to build the project when first checking this repo out. I'm running on an M1 MacBook Air running Big Sur (version 11.1).

I think this error is related to old versions of some dependencies being pinned in package-lock.json and forcing an old version of node-gyp, which fails on recent builds of Mac OS.

I was able to regenerate the package-lock.json without updating any dependencies in package.json, and now the build succeeds. The bcrypto package that was failing to build on the main branch isn't even pulled in anymore, so one of our transitive dependencies must have updated.

Hopefully closes #576

@yusefnapora
Copy link
Collaborator Author

BTW, I also hit this issue related to the new M1 macs: #613

But it's a pretty edgy edge case and probably won't affect that many people.

@terichadbourne
Copy link
Member

Thank you @yusefnapora! I'm going to defer to @zebateira on reviewing this one since he's been more involved in investigating our earlier issues with npm install.

@terichadbourne terichadbourne removed their assignment Feb 15, 2021
@zebateira
Copy link
Contributor

The build stills fails 😢

image

Which is weird because I also see this happening:

The bcrypto package that was failing to build on the main branch isn't even pulled in anymore, so one of our transitive dependencies must have updated.

image

Looking into this 👍

@yusefnapora
Copy link
Collaborator Author

Hmm, I think I may be making things more confusing by having two versions of nodejs installed. If I completely delete node_modules, I get different results for npm ls bcrypto depending on which node I use.

With version 15.8.0, compiled for apple silicon:

$ env PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=1 npm install

added 3008 packages, and audited 3075 packages in 22s

33 vulnerabilities (3 low, 4 moderate, 26 high)

To address issues that do not require attention, run:
  npm audit fix

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.
$ npm ls bcrypto
protoschool@1.0.0 /Users/yusef/work/repos/protoschool.github.io
└── (empty)

But, if I install with v14.15.5 (Intel version), I get this:

npm ls bcrypto
protoschool@1.0.0 /Users/yusef/work/repos/protoschool.github.io
└─┬ ipfs@0.48.2
  └─┬ libp2p-noise@1.1.2
    └── UNMET DEPENDENCY bcrypto@5.1.0

npm ERR! missing: bcrypto@5.1.0, required by libp2p-noise@1.1.2

as well as a warning about the package lock file using version 2 of the lockfile syntax when I do the npm install:

npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.json was generated for lockfileVersion@2. I'll try to do my best with it!

So it looks like the "fix" from this branch only works with node v15 and the new lockfile syntax, although the install still succeeds using the v2 lockfile (on my machine).

I just added a commit that bumps our ipfs dependency to the latest, v0.54.2 - this should solve the root problem, since now we depend on a non-broken version of bcrypto (5.4.0):

npm ls bcrypto
protoschool@1.0.0 /Users/yusef/work/repos/protoschool.github.io
└─┬ ipfs@0.54.2
  └─┬ ipfs-core@0.5.2
    └─┬ libp2p-noise@2.0.4
      └── bcrypto@5.4.0

Assuming that updating ipfs doesn't break anything, we should be good :)

@yusefnapora
Copy link
Collaborator Author

btw, I forgot to mention that I used v14 for the previous commit, so it has the version 1 lockfile.

@yusefnapora yusefnapora changed the title fix macos build: regenerate package-lock fix macos build: update ipfs dependency to v0.54.2 Feb 17, 2021
@yusefnapora
Copy link
Collaborator Author

Assuming that updating ipfs doesn't break anything, we should be good :)

hmm... I'll have a go at running the tests locally and see if anything jumps out at me

@zebateira
Copy link
Contributor

Assuming that updating ipfs doesn't break anything, we should be good :)

Unfortunately updating IPFS in ProtoSchool is not as straightforward as it could be: because our code challenges and content directly depend on a specific version of IPFS, we need to carefully analyze each IPFS release and check the impact on the code and content. Code migrations are easier than content updates.

But this is a good call out for this issue since there are somethings that we can improve to make this process more streamlined:

  • Document IPFS usage dependency on content and code
  • Setup a scheduled IPFS update task so we don't fall behind so often and risk going through issues like these

Tracking this here. It also takes into account that libp2p might need this as well.

@zebateira
Copy link
Contributor

@yusefnapora can you make your local build work without updating IPFS? We can temporarily only use node v15, work on the new libp2p tute, and then we can come back to this and upgrade IPFS.
If not, upgrading IPFS is the solution anyways because we will need to do it sometime soon.

@zebateira
Copy link
Contributor

I can't seem to make it work in node v15. And since it doesn't work in fleek anyways, I guess we need to tackle the IPFS dep update.

@yusefnapora
Copy link
Collaborator Author

yusefnapora commented Feb 18, 2021

I think I found a version of IPFS that's new enough to fix the issue, but not new enough to cause it's own issues 😄

That is, ipfs@0.50.2 pulls in bcrypto@5.4.0, which builds fine on my machine. I'm still running the tests locally, but the file upload tests that were failing with the latest ipfs have passed, so I've pushed it up for fleek to try. Fingers crossed...

@yusefnapora yusefnapora changed the title fix macos build: update ipfs dependency to v0.54.2 fix macos build: update ipfs dependency to v0.50.2 Feb 18, 2021
@yusefnapora
Copy link
Collaborator Author

Yay, the tests passed locally!

  (Run Finished)


       Spec                                              Tests  Passing  Failing  Pending  Skipped
  ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
  │ ✔  courses.spec.js                          00:06        4        4        -        -        - │
  ├────────────────────────────────────────────────────────────────────────────────────────────────┤
  │ ✔  redirects.spec.js                        00:18        1        1        -        -        - │
  ├────────────────────────────────────────────────────────────────────────────────────────────────┤
  │ ✔  tutorial-messages.spec.js                00:12       14       14        -        -        - │
  ├────────────────────────────────────────────────────────────────────────────────────────────────┤
  │ ✔  tutorial-redirect-modal.spec.js          00:23       12       12        -        -        - │
  ├────────────────────────────────────────────────────────────────────────────────────────────────┤
  │ ✔  tutorials.spec.js                        11:44      338      338        -        -        - │
  └────────────────────────────────────────────────────────────────────────────────────────────────┘
    ✔  All specs passed!                        12:44      369      369        -        -        -

@zebateira
Copy link
Contributor

@yusefnapora yay!

Copy link
Contributor

@zebateira zebateira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

@zebateira zebateira merged commit e444681 into main Feb 18, 2021
@zebateira zebateira deleted the fix/build-macos-bcrypto branch February 18, 2021 18:21
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 this pull request may close these issues.

Bug: IPFS not installing when repo is cloned and installed
3 participants