facebook/fbt

Dependencies between the latest fbt packages seems to be busted

deadalnix opened this issue ยท 5 comments

๐Ÿ› Bug Report

It looks like that the most recent version of fbt, babel-plugin-fbt and babel-plugin-fbt-runtime

To Reproduce

Create an empty folder and get started with

npm i

Now that we got a fresh and empty module, let's try to install fbt:

npm i fbt babel-plugin-fbt babel-plugin-fbt-runtime

We get the following error:

$ npm i fbt babel-plugin-fbt babel-plugin-fbt-runtime
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: undefined@undefined
npm ERR! Found: babel-plugin-fbt@0.16.0
npm ERR! node_modules/babel-plugin-fbt
npm ERR!   babel-plugin-fbt@"*" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer babel-plugin-fbt@"^0.10.x" from fbt@0.16.0
npm ERR! node_modules/fbt
npm ERR!   fbt@"*" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See /home/deadalnix/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/deadalnix/.npm/_logs/2021-01-06T22_04_00_308Z-debug.log

Note that babel-plugin-fbt and babel-plugin-fbt-runtime can be installed individually, but not together, fbt cannot be installed at all without using --force .

Expected behavior

Node install the fbt packages and we can continue out happy life.

envinfo

$ npx envinfo --system --binaries

  System:
    OS: Linux 5.9 Debian GNU/Linux bullseye/sid
    CPU: (12) x64 Intel(R) Xeon(R) CPU D-1531 @ 2.20GHz
    Memory: 18.07 GB / 31.27 GB
    Container: Yes
    Shell: 5.1.0 - /bin/bash
  Binaries:
    Node: 12.19.0 - /usr/bin/node
    npm: 7.3.0 - /usr/bin/npm
    Watchman: 4.9.0 - /usr/bin/watchman

Interesting... while we should update those peer dependencies, I don't believe these should be errors. I see npm WARN's when I run this... Can you try the following before running npm i fbt ...?

echo "{}" > package.json

I have a suspicion this may be attempting global install. That npm ERR! While resolving: undefined@undefined looks suspicious.

$ ls -a # nothing
.	..
$ echo '{}' > package.json
$ npm i fbt babel-plugin-fbt babel-plugin-fbt-runtime
npm WARN deprecated core-js@2.6.12: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.

> core-js@2.6.12 postinstall /Users/jwatson/workspace/testbed/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"

npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN babel-plugin-fbt-runtime@0.9.12 requires a peer of babel-plugin-fbt@^0.14.2 but none is installed. You must install peer dependencies yourself.
npm WARN fbt@0.16.0 requires a peer of babel-plugin-fbt@^0.10.x but none is installed. You must install peer dependencies yourself.
npm WARN fbt@0.16.0 requires a peer of react@0.12.0 - 16.x.x but none is installed. You must install peer dependencies yourself.
npm WARN testbed No description
npm WARN testbed No repository field.
npm WARN testbed No license field.

+ babel-plugin-fbt@0.16.0
+ babel-plugin-fbt-runtime@0.9.12
+ fbt@0.16.0
added 134 packages from 178 contributors and audited 134 packages in 7.946s

10 packages are looking for funding
  run `npm fund` for details

found 1 low severity vulnerability
  run `npm audit fix` to fix them, or `npm audit` for details

Fair warning, I'm using npm 6.14.8. Don't know if that changes things, but I'd be surprised if it did.
envinfo

npx: installed 1 in 1.207s

  System:
    OS: macOS 10.15.7
    CPU: (12) x64 Intel(R) Core(TM) i9-8950HK CPU @ 2.90GHz
    Memory: 2.49 GB / 32.00 GB
    Shell: 5.0.16 - /usr/local/bin/bash
  Binaries:
    Node: 12.19.0 - ~/.nvm/versions/node/v12.19.0/bin/node
    Yarn: Using globally installed version of Yarn
1.12.1 - /opt/facebook/bin/yarn
    npm: 6.14.8 - ~/.nvm/versions/node/v12.19.0/bin/npm
    Watchman: 20201205 - /opt/facebook/bin/watchman
$ mkdir test
$ cd test/
$ ls -la
total 8
drwxr-xr-x  2 deadalnix deadalnix 4096 Jan  6 23:55 .
drwxr-xr-x 30 deadalnix deadalnix 4096 Jan  6 23:55 ..
deadalnix@devbox:~/test$ echo '{}' > package.json
deadalnix@devbox:~/test$ npm i fbt babel-plugin-fbt babel-plugin-fbt-runtime
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: undefined@undefined
npm ERR! Found: babel-plugin-fbt@0.16.0
npm ERR! node_modules/babel-plugin-fbt
npm ERR!   babel-plugin-fbt@"*" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer babel-plugin-fbt@"^0.10.x" from fbt@0.16.0
npm ERR! node_modules/fbt
npm ERR!   fbt@"*" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See /home/deadalnix/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/deadalnix/.npm/_logs/2021-01-06T22_56_05_569Z-debug.log

The exact steps you requested.

Yeah I'm guessing it's the npm version at play here. See the bit about peer dependencies
https://github.blog/2020-10-13-presenting-v7-0-0-of-the-npm-cli/

\o/

Thanks