facebook/fbt

Can't install FBT with npm

DennisSkoko opened this issue ยท 1 comments

๐Ÿ› Bug Report

I'm trying to install fbt on a fresh project but I'm unable to since my guess is that fbt wants a dependency version for babel-plugin-fbt-runtime which doesn't exists.

To Reproduce

Run npm i fbt or npm i fbt --force. Have also tried npm i fbt babel-plugin-fbt babel-plugin-fbt-runtime --force

I have also tried

Expected behavior

Depencies being installed with no issues.

Actual behaviour

npm WARN using --force Recommended protections disabled.
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: @fbtjs/default-collection-transform@0.0.3
npm WARN Found: babel-plugin-fbt@0.21.0
npm WARN node_modules/babel-plugin-fbt
npm WARN   peer babel-plugin-fbt@"^0.21.x" from fbt@0.17.0
npm WARN   node_modules/fbt
npm WARN     fbt@"*" from the root project
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer babel-plugin-fbt@"^0.20.x" from @fbtjs/default-collection-transform@0.0.3
npm WARN node_modules/@fbtjs/default-collection-transform
npm WARN   peer @fbtjs/default-collection-transform@"~0.0.3" from babel-plugin-fbt@0.21.0
npm WARN   node_modules/babel-plugin-fbt
npm WARN
npm WARN Conflicting peer dependency: babel-plugin-fbt@0.20.3
npm WARN node_modules/babel-plugin-fbt
npm WARN   peer babel-plugin-fbt@"^0.20.x" from @fbtjs/default-collection-transform@0.0.3
npm WARN   node_modules/@fbtjs/default-collection-transform
npm WARN     peer @fbtjs/default-collection-transform@"~0.0.3" from babel-plugin-fbt@0.21.0
npm WARN     node_modules/babel-plugin-fbt
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: fbt@0.17.0
npm WARN Found: babel-plugin-fbt-runtime@undefined
npm WARN node_modules/babel-plugin-fbt-runtime
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer babel-plugin-fbt-runtime@"^0.10.x" from fbt@0.17.0
npm WARN node_modules/fbt
npm WARN   fbt@"*" from the root project
npm ERR! code ETARGET
npm ERR! notarget No matching version found for fb-babel-plugin-utils@^0.13.0.
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.

The actual error is that it can't find fb-babel-plugin-utils@^0.13.0 but I can't tell who wants it. The only fishy I could find it https://github.com/facebook/fbt/blob/fbt-v0.17.0/packages/fbt/package.json#L37. It wants babel-plugin-fbt-runtime@^0.10.x but there are only 0.10.0-rc{x}-beta versions at npm https://www.npmjs.com/package/babel-plugin-fbt-runtime

Workaround

Installing the older version fbt@0.16.6.

envinfo

  System:
    OS: Windows 10 10.0.22000
    CPU: (8) x64 Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz
    Memory: 16.41 GB / 31.88 GB
  Binaries:
    Node: 16.13.0 - C:\Program Files\nodejs\node.EXE
    npm: 8.1.4 - C:\Program Files\nodejs\npm.CMD

Hi - thank you for reporting this!

The problem is that fbt@0.17.0(the latest public) requires babel-plugin-fbt@0.21.x through peer dependency, while @fbtjs/default-collection-transform requires babel-plugin-fbt@0.20.x.

To unblock yourself, you can install the previous public release of fbt which is fbt@0.16.6. It requires babel-plugin-fbt@0.20.x as a peer, so this should no longer be in conflict with @fbtjs/default-collection-transform

npm i fbt@0.16.6 babel-plugin-fbt babel-plugin-fbt-runtime

Note: We are going to publish a new release of @fbtjs/default-collection-transform which requires the latest babel-plugin-fbt, so hopefully you won't need this workaround soon.