ReduxSimpleStarter icon indicating copy to clipboard operation
ReduxSimpleStarter copied to clipboard

Can't install react-sparklines

Open salsadeanguila opened this issue 8 years ago • 9 comments

When I try to install sparklines it shows an error in the console:

└─┬ [email protected]  └── UNMET PEER DEPENDENCY react@^15.2.1
npm WARN EPEERINVALID [email protected] requires a peer of react@^15.2.1 but none was installed.

I googled the error and tried to change the react dependency in package.json from: ^0.14.8 to 15.2.1

But now it throws two errors:

npm WARN EPEERINVALID [email protected] requires a peer of react@^0.14.8 but none was installed.
npm WARN EPEERINVALID [email protected] requires a peer of react@^0.14.8 but none was installed.

Found this errors because when I try to render Sparklines it throws theres errors on console:

bundle.js:1269 Warning: React.createElement: type should not be null, undefined, boolean, or number. It should be a string (for DOM elements) or a ReactClass (for composite components). Check the render method of `WeatherList`.warning @ bundle.js:1269createElement @ bundle.js:3170renderWeather @ bundle.js:25215render @ bundle.js:25256_renderValidatedComponentWithoutOwnerOrContext @ bundle.js:15767_renderValidatedComponent @ bundle.js:15793_updateRenderedComponent @ bundle.js:15717_performComponentUpdate @ bundle.js:15697updateComponent @ bundle.js:15616receiveComponent @ bundle.js:15516receiveComponent @ bundle.js:7583_updateRenderedComponent @ bundle.js:15719_performComponentUpdate @ bundle.js:15697updateComponent @ bundle.js:15616performUpdateIfNecessary @ bundle.js:15530performUpdateIfNecessary @ bundle.js:7617runBatchedUpdates @ bundle.js:7207perform @ bundle.js:8440perform @ bundle.js:8440perform @ bundle.js:7146flushBatchedUpdates @ bundle.js:7229closeAll @ bundle.js:8506perform @ bundle.js:8453batchedUpdates @ bundle.js:17525enqueueUpdate @ bundle.js:7257enqueueUpdate @ bundle.js:16426enqueueSetState @ bundle.js:16610ReactComponent.setState @ bundle.js:1700handleChange @ bundle.js:21577dispatch @ bundle.js:21961(anonymous function) @ bundle.js:22863dispatch @ bundle.js:22500action.payload.then._extends.payload @ bundle.js:22860
bundle.js:814 Uncaught (in promise) Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. Check the render method of `WeatherList`.(…)

If I remove the Sparklines elements it doesn't throw any errors in the console.

salsadeanguila avatar Jul 25 '16 01:07 salsadeanguila

Here is my package.json file when I worked on this tutorial. I hope it helps. I had no problems at all using "react": "^0.14.3" https://github.com/gabemartinez/clima/blob/master/package.json

gabemartinez avatar Jul 25 '16 03:07 gabemartinez

@gabemartinez thank you but it still shows the same error, I think it's something about my environment but I don't have a clue what it could be

salsadeanguila avatar Jul 25 '16 16:07 salsadeanguila

@salsadeanguila You may just have some invalid JSX

seminull avatar Aug 04 '16 00:08 seminull

@salsadeanguila I saw the same initial warning when installing react-sparklines for the weather app.

└─┬ [email protected] 
  └── UNMET PEER DEPENDENCY react@^15.3.1
npm WARN [email protected] requires a peer of react@^15.3.1 but none was installed.

I basically ignored it, and was still able to successfully import the sparkline components into the project without changing any of the dependencies. I think it's an issue with the peerDependency in the react-sparklines module.

noel-gonzales avatar Sep 12 '16 20:09 noel-gonzales

Just ran into this. Installing an older version of sparklines works. The newest version must require a newer version of react than what we use with the simple starter. Just run

npm install --save [email protected]

freb avatar Jan 25 '17 00:01 freb

Sorry, but I'm having the same error as the first comment.

I added import { Sparklines, SparklinesLine } from 'react-sparklines'; and this is my package.json:

{
  "name": "redux-simple-starter",
  "version": "1.0.0",
  "description": "Simple starter package for Redux with React and Babel support",
  "main": "index.js",
  "repository": "[email protected]:StephenGrider/ReduxSimpleStarter.git",
  "scripts": {
    "start": "node ./node_modules/webpack-dev-server/bin/webpack-dev-server.js",
    "test": "mocha --compilers js:babel-core/register --require ./test/test_helper.js --recursive ./test",
    "test:watch": "npm run test -- --watch"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "babel-core": "^6.2.1",
    "babel-loader": "^6.2.0",
    "babel-preset-es2015": "^6.1.18",
    "babel-preset-react": "^6.1.18",
    "chai": "^3.5.0",
    "chai-jquery": "^2.0.0",
    "jquery": "^2.2.1",
    "jsdom": "^8.1.0",
    "mocha": "^2.4.5",
    "react-addons-test-utils": "^0.14.7",
    "webpack": "^1.12.9",
    "webpack-dev-server": "^1.14.0"
  },
  "dependencies": {
    "axios": "^0.16.2",
    "babel-preset-stage-1": "^6.1.18",
    "lodash": "^3.10.1",
    "react": "^0.14.3",
    "react-dom": "^0.14.3",
    "react-redux": "4.3.0",
    "react-router": "^2.0.1",
    "react-sparklines": "^1.4.0",
    "redux": "^3.0.4",
    "redux-promise": "^0.5.3"
  }
}

but still with error:

Uncaught TypeError: Super expression must either be null or a function, not undefined
    at _inherits (bundle.js:25009)
    at bundle.js:25012
    at Object.<anonymous> (bundle.js:25056)
    at __webpack_require__ (bundle.js:24383)
    at Object.defineProperty.value (bundle.js:24947)
    at __webpack_require__ (bundle.js:24383)
    at Object.<anonymous> (bundle.js:24937)
    at __webpack_require__ (bundle.js:24383)
    at bundle.js:24426
    at bundle.js:24429

Do you have any update with dependencies problems? Thanks for any help!!!

Miguel-Herrero avatar Aug 02 '17 18:08 Miguel-Herrero

It was solved with the update suggested in #117

Miguel-Herrero avatar Aug 03 '17 20:08 Miguel-Herrero

as @freb mentioned just downgrade sparklines in your package.json to 1.5.0. mine was 1.7.0, and also tried 1.6.0 which both game me an error:

"Uncaught TypeError: Super expression must either be null or a function, not undefined"

roee-leverate avatar Feb 27 '18 18:02 roee-leverate

@roee-leverate

downgrade to version 1.4.2 when i downgraded by charts are loading just fine.

$ npm uninstall react-sparklines --save

Thereafter install version 1.4.2

$ npm install [email protected] --save

All The Best

chitwarnold avatar Feb 28 '18 20:02 chitwarnold