Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

fresh installs of js-ipfs fail to build with browserify. peer-id suspect #2283

Closed
npfoss opened this issue Jul 21, 2019 · 3 comments
Closed
Labels
exp/novice Someone with a little familiarity can pick up kind/bug A bug in existing code (including security flaws) P1 High: Likely tackled by core team if no one steps up status/blocked Unable to be worked further until needs are met status/ready Ready to be worked

Comments

@npfoss
Copy link
Contributor

npfoss commented Jul 21, 2019

  • Version: 0.36.4 and 0.37.0-rc.0 (didn't test others)
  • Platform: Linux npfoss-yoga-1810 4.18.0-25-generic node-multihashing and multihash #26-Ubuntu SMP Mon Jun 24 09:32:08 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
  • Subsystem: peer-id suspected

Type: Bug

Severity: High

Description:

I reported this here but since it's breaking all of js-ipfs I thought it would be good to draw more attention in the main repo.

Browserify-ing any recent version of js-ipfs fails with:

Error: Cannot find module 'babelify' from '/path/to/code/node_modules/peer-id/node_modules/async'

I looked into this some and I think the problem is that peer-id had a semver lapse, because lots of js-ipfs things depend on ~0.12.x and with 0.12.2 everything is fine, but 10 days ago 0.12.3, 0.13.0, 0.13.1, and 0.13.2 were published in quick succession. Now when installing fresh, package-lock.json shows some instances of 0.12.3. The very close pattern of releases makes me think they realized it wasn't working and pushed some fixes, but forgot to remove the broken versions, especially 0.12.3.

Steps to reproduce the error:

package.json

{
  "scripts": {
    "build": "browserify index.js -o app.js -d"
  },
  "dependencies": {
    "browserify": "^16.3.0",
    "ipfs": "^0.36.4"
  }
}

index.js

require('ipfs');

run

npm install
npm run build

Also available to be cloned here: https://github.com/npfoss/js-ipfs-bug-code

@alanshaw alanshaw added status/blocked Unable to be worked further until needs are met kind/bug A bug in existing code (including security flaws) exp/novice Someone with a little familiarity can pick up P1 High: Likely tackled by core team if no one steps up status/ready Ready to be worked labels Jul 22, 2019
@alanshaw
Copy link
Member

Cross posting here for reference:

This looks like it might be an issue with v3 of async caolan/async#1653 (comment)

libp2p/js-peer-id#96 (comment)

async added a browserify transform (babelify) to their package.json but do not depend on it themselves. If your project also does not depend on babelify you'll get this error because browserify will attempt to use the transform but it is not installed.

You can work around it by adding ignoreTransform: ['babelify'] for the time being.

@npfoss
Copy link
Contributor Author

npfoss commented Jul 22, 2019

That fixed it, thank you so much!

I pushed the fix to that github repo for anyone who's interested

@npfoss npfoss closed this as completed Jul 22, 2019
npfoss added a commit to npfoss/gravity-minimal that referenced this issue Jul 22, 2019
This flag can probably be removed later, but for now it's necessary to avoid the issues discussed and resolved here (and in linked issues): ipfs/js-ipfs#2283
@alanshaw
Copy link
Member

A new version of peer-id (0.12.4) has been released reverting to async@2 in order to address this issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
exp/novice Someone with a little familiarity can pick up kind/bug A bug in existing code (including security flaws) P1 High: Likely tackled by core team if no one steps up status/blocked Unable to be worked further until needs are met status/ready Ready to be worked
Projects
None yet
Development

No branches or pull requests

2 participants