remirror icon indicating copy to clipboard operation
remirror copied to clipboard

Missing `peerDependencies` when using pnpm with strict peer dependencies

Open tomi-bigpi opened this issue 2 years ago β€’ 0 comments

Summary

Following the installation instructions, package installation using pnpm fails due to missing (strict) peer dependencies.

Steps to reproduce

pnpm --version
6.32.3

Create the following package.json:

{
  "name": "remirror-peerdep-issue",
  "version": "1.0.0",
  "description": "Remirror peer dependency problem with pnpm.",
  "private": true,
  "type": "module",
  "scripts": {
  },
  "dependencies": {
    "@types/react": "17.0.40",
    "@types/react-dom": "17.0.13",
    "@remirror/react": "~1.0.42",
    "@remirror/pm": "~1.0.21",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "remirror": "~1.0.87"
  },
  "devDependencies": {
    "typescript": "~4.6.4"
  },
  "peerDependencies": {}
}

Then run pnpm install.

Expected results

Either required dependencies are listed in the documentation, or Remirror peer/dependencies are adjusted to avoid warnings and errors when packages are installed.

Actual results

pnpm install shows the following output. Using strict peer dependencies (we're using Microsoft Rush for monorepo management) causes installation, and thus builds, to fail.

Removing the React dependencies removes the error related to @remirror/react / @remirror/extension-react-tables

Packages are hard linked from the content-addressable store to the virtual store.
  Content-addressable store is at: /Users/username/.pnpm-store/v3
  Virtual store is at:             node_modules/.pnpm

dependencies:
+ @remirror/pm 1.0.21
+ @remirror/react 1.0.42
+ @types/react 17.0.40 (18.0.12 is available)
+ @types/react-dom 17.0.13 (18.0.5 is available)
+ react 17.0.2 (18.1.0 is available)
+ react-dom 17.0.2 (18.1.0 is available)
+ remirror 1.0.87

devDependencies:
+ typescript 4.6.4 (4.7.3 is available)

 WARN  Issues with peer dependencies found
.
β”œβ”€β”¬ @remirror/react
β”‚ └─┬ @remirror/extension-react-tables
β”‚   └─┬ @emotion/css
β”‚     β”œβ”€β”€ βœ• missing peer @babel/core@^7.0.0
β”‚     └─┬ @emotion/babel-plugin
β”‚       β”œβ”€β”€ βœ• missing peer @babel/core@^7.0.0
β”‚       └─┬ @babel/plugin-syntax-jsx
β”‚         └── βœ• missing peer @babel/core@^7.0.0-0
└─┬ remirror
  └─┬ @remirror/extension-yjs
    └─┬ y-prosemirror
      β”œβ”€β”€ βœ• missing peer prosemirror-model@^1.7.1
      β”œβ”€β”€ βœ• missing peer prosemirror-state@^1.2.3
      └── βœ• missing peer prosemirror-view@^1.9.10
Peer dependencies that should be installed:
  @babel/core@">=7.0.0 <8.0.0"  prosemirror-model@^1.7.1      prosemirror-state@^1.2.3      prosemirror-view@^1.9.10

Progress: resolved 330, reused 330, downloaded 0, added 330, done

Possible Solution

Add the listed peer dependencies to your packages.json. However, currently this results in various TypeScript errors in multiple dependencies due to recent ProseMirror TypeScript changes (somewhat unrelated).

Screenshot(s)

image

tomi-bigpi avatar Jun 10 '22 15:06 tomi-bigpi