grafana / plugin-tools

Create Grafana plugins with ease.
https://grafana.com/developers/plugin-tools/
Apache License 2.0
58 stars 32 forks source link

Bug: Conflicted dependencies in datasource plugin generated by create-plugin #194

Closed DiamondMofeng closed 1 year ago

DiamondMofeng commented 1 year ago

Package Name

create-plugin

What happened?

Just created a new datasource using @grafana/create-plugin

Then tried to npm install

PS D:\projects\js\11111\bar-foo-datasource> npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: foo@1.0.0
npm ERR! Found: react@17.0.2
npm ERR! node_modules/react
npm ERR!   react@"17.0.2" from the root project    
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^18.0.0" from @testing-library/react@13.4.0
npm ERR! node_modules/@testing-library/react
npm ERR!   dev @testing-library/react@"^13.4.0" 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 C:\Users\v3630\AppData\Local\npm-cache\eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\v3630\AppData\Local\npm-cache\_logs\2023-02-01T14_27_33_114Z-debug.log
PS D:\projects\js\11111\bar-foo-datasource>
D:\projects\js\11111>npx @grafana/create-plugin
Need to install the following packages:
  @grafana/create-plugin
Ok to proceed? (y) y
? What is going to be the name of your plugin? foo
? What is the organization name of your plugin? bar
? How would you describe your plugin? foobar
? What kind of plugin would you like?  datasource
? Do you want a backend part of your plugin? No
? Do you want to add Github CI and Release workflows? No
? Do you want to add a Github workflow for automatically checking "Grafana API compatibility" on PRs? No
√  ++ D:\projects\js\11111\bar-foo-datasource\.config\.eslintrc
√  ++ D:\projects\js\11111\bar-foo-datasource\.config\.prettierrc.js
√  ++ D:\projects\js\11111\bar-foo-datasource\.config\Dockerfile
√  ++ D:\projects\js\11111\bar-foo-datasource\.config\jest-setup.js
√  ++ D:\projects\js\11111\bar-foo-datasource\.config\jest.config.js
√  ++ D:\projects\js\11111\bar-foo-datasource\.config\jest\mocks\react-inlinesvg.tsx
√  ++ D:\projects\js\11111\bar-foo-datasource\.config\jest\utils.js
√  ++ D:\projects\js\11111\bar-foo-datasource\.config\README.md
√  ++ D:\projects\js\11111\bar-foo-datasource\.config\tsconfig.json
√  ++ D:\projects\js\11111\bar-foo-datasource\.config\types\custom.d.ts
√  ++ D:\projects\js\11111\bar-foo-datasource\.config\webpack\constants.ts
√  ++ D:\projects\js\11111\bar-foo-datasource\.config\webpack\utils.ts
√  ++ D:\projects\js\11111\bar-foo-datasource\.config\webpack\webpack.config.ts
√  ++ D:\projects\js\11111\bar-foo-datasource\.eslintrc
√  ++ D:\projects\js\11111\bar-foo-datasource\.nvmrc
√  ++ D:\projects\js\11111\bar-foo-datasource\.prettierrc.js
√  ++ D:\projects\js\11111\bar-foo-datasource\CHANGELOG.md
√  ++ D:\projects\js\11111\bar-foo-datasource\cypress\integration\01-smoke.spec.ts
√  ++ D:\projects\js\11111\bar-foo-datasource\docker-compose.yaml
√  ++ D:\projects\js\11111\bar-foo-datasource\.gitignore
√  ++ D:\projects\js\11111\bar-foo-datasource\jest-setup.js
√  ++ D:\projects\js\11111\bar-foo-datasource\jest.config.js
√  ++ D:\projects\js\11111\bar-foo-datasource\LICENSE
√  ++ D:\projects\js\11111\bar-foo-datasource\package.json
√  ++ D:\projects\js\11111\bar-foo-datasource\src\img\logo.svg
√  ++ D:\projects\js\11111\bar-foo-datasource\src\README.md
√  ++ D:\projects\js\11111\bar-foo-datasource\tsconfig.json
√  ++ D:\projects\js\11111\bar-foo-datasource\README.md
√  ++ D:\projects\js\11111\bar-foo-datasource\src\components\ConfigEditor.tsx
√  ++ D:\projects\js\11111\bar-foo-datasource\src\components\QueryEditor.tsx
√  ++ D:\projects\js\11111\bar-foo-datasource\src\datasource.ts
√  ++ D:\projects\js\11111\bar-foo-datasource\src\module.ts
√  ++ D:\projects\js\11111\bar-foo-datasource\src\plugin.json
√  ++ D:\projects\js\11111\bar-foo-datasource\src\types.ts
√  +- D:\projects\js\11111\bar-foo-datasource\README.md
√  +- D:\projects\js\11111\bar-foo-datasource\README.md

D:\projects\js\11111>

What you expected to happen

It should have no error using npm install

How to reproduce it (as minimally and precisely as possible)

  1. Use npx @grafana/create-plugin to create a datasource plugin
  2. cd to the project folder then npm install

Environment

`envinfo` seems to be broken on Windows...

D:\projects\js\11111>npm -v
8.1.2

D:\projects\js\11111>node -v
v16.13.1


### Additional context

_No response_
DiamondMofeng commented 1 year ago

Solved after upgrading @grafana/create-plugin