blitz-js / legacy-framework

MIT License
3 stars 2 forks source link

Unable to install latest blitz globally with Node 14.16.0 (latest LTS) and latest npm on latest macOS #197

Closed rodrigoehlers closed 3 years ago

rodrigoehlers commented 3 years ago

What is the problem?

When running npm i -g blitz on Node.js version 14.16.0 with npm version 7.6.1, the install fails with the following error output.

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! Found: react@17.0.1
npm ERR! node_modules/react
npm ERR!   peer react@"^16.6.0 || ^17" from next@10.0.7
npm ERR!   node_modules/next
npm ERR!     peer next@"*" from blitz@0.31.0
npm ERR!     node_modules/blitz
npm ERR!       blitz@"*" from the root project
npm ERR!     next@"10.0.7" from @blitzjs/core@0.31.0
npm ERR!     node_modules/blitz/node_modules/@blitzjs/core
npm ERR!       @blitzjs/core@"0.31.0" from blitz@0.31.0
npm ERR!       node_modules/blitz
npm ERR!         blitz@"*" from the root project
npm ERR!       1 more (@blitzjs/server)
npm ERR!     1 more (babel-plugin-superjson-next)
npm ERR!   peer react@"17.0.1" from react-dom@17.0.1
npm ERR!   node_modules/react-dom
npm ERR!     peer react-dom@"^16.6.0 || ^17" from next@10.0.7
npm ERR!     node_modules/next
npm ERR!       peer next@"*" from blitz@0.31.0
npm ERR!       node_modules/blitz
npm ERR!         blitz@"*" from the root project
npm ERR!       2 more (@blitzjs/core, babel-plugin-superjson-next)
npm ERR!     peer react-dom@"*" from @testing-library/react@11.2.5
npm ERR!     node_modules/blitz/node_modules/@testing-library/react
npm ERR!       @testing-library/react@"^11.2.3" from blitz@0.31.0
npm ERR!       node_modules/blitz
npm ERR!         blitz@"*" from the root project
npm ERR!     1 more (@next/react-dev-overlay)
npm ERR!   7 more (@blitzjs/core, @testing-library/react, ...)
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.8.0" from react-query@2.5.12
npm ERR! node_modules/blitz/node_modules/@blitzjs/core/node_modules/react-query
npm ERR!   react-query@"2.5.12" from @blitzjs/core@0.31.0
npm ERR!   node_modules/blitz/node_modules/@blitzjs/core
npm ERR!     @blitzjs/core@"0.31.0" from blitz@0.31.0
npm ERR!     node_modules/blitz
npm ERR!       blitz@"*" from the root project
npm ERR!     1 more (@blitzjs/server)
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.

If re-trying with --legacy-peer-deps as suggested, it works.

This could have something to do with the way peer dependencies are handled in the new npm major version 7.y.z+.

What are detailed steps to reproduce this?

See section "What is the problem?".

Run blitz -v and paste the output here:

After installing with --legacy-peer-deps and deliberately not running in a blitz project folder.

You are using beta software - if you have any problems, please open an issue here:
      https://github.com/blitz-js/blitz/issues/new/choose

macOS Big Sur | darwin-x64 | Node: v14.16.0

blitz: 0.30.6 (global)

  Package manager: npm 
  System:
    OS: macOS 11.2.2
    CPU: (8) x64 Intel(R) Core(TM) i7-1068NG7 CPU @ 2.30GHz
    Memory: 1.27 GB / 32.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 14.16.0 - ~/.nvm/versions/node/v14.16.0/bin/node
    Yarn: Not Found
    npm: 7.6.1 - ~/.nvm/versions/node/v14.16.0/bin/npm
    Watchman: Not Found
  npmPackages:
    @prisma/client: Not Found
    blitz: Not Found
    prisma: Not Found
    react: Not Found
    react-dom: Not Found
    typescript: Not Found

Notice blitz version being printed as 0.30.6 though running npm list -g --depth=0 prints the following.

/Users/rodrigoehlers/.nvm/versions/node/v14.16.0/lib
├── blitz@0.31.0
└── npm@7.6.1
flybayer commented 3 years ago

Yeah, we need to remove peerDependencies from pkg json and use patch-package to patch manypkg so that it doesn't use peerDeps.

aidan-rypens commented 3 years ago

Same problem here on Windows, Node v15.11.0. With the suggestion --legacy-peer-deps it works.