create-react-app,npm start 失败,babel-jest版本不一致的问题

问题

The react-scripts package provided by Create React App requires a dependency:

  "babel-jest": "23.6.0"

Don't try to install it manually: your package manager does it automatically.

However, a different version of babel-jest was detected higher up in the tree:

  /home/karan/workspace/node_modules/babel-jest (version: 22.4.4)

解决方法

1. 删除yarn.lock和node-modules

2. 修改package.json,添加

"resolutions": {

    "jest": "23.6.0",

    "babel-jest": "23.6.0"

},

3. npm install

4. npm start

可参考 https://yarnpkg.com/lang/en/docs/selective-version-resolutions/

你可能感兴趣的:(create-react-app,npm start 失败,babel-jest版本不一致的问题)