当前位置 : 主页 > 网页制作 > React >

reactjs – travis无法构建,因为错误:无法找到模块’react-test-renderer / shallow’

来源:互联网 收集:自由互联 发布时间:2021-06-15
npm运行测试在本地工作正常. 但是,travis坚持认为构建失败并显示以下日志: react-test-renderer is an implicit dependency in order to support react@15.5+. Please add the appropriate version to your devDependencies. S
npm运行测试在本地工作正常.

但是,travis坚持认为构建失败并显示以下日志:

react-test-renderer is an implicit dependency in order to support react@15.5+. Please add the appropriate version to your devDependencies. See https://github.com/airbnb/enzyme#installation
No coverage information was collected, exit without writing coverage information
/home/travis/build/abdennour/react-csv/node_modules/enzyme/build/react-compat.js:159
      throw e;
      ^
Error: Cannot find module 'react-test-renderer/shallow'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at /home/travis/build/abdennour/react-csv/node_modules/enzyme/build/react-compat.js:151:34
    at Object.<anonymous> (/home/travis/build/abdennour/react-csv/node_modules/enzyme/build/react-compat.js:219:5)

任何的想法 ?我知道我的依赖是:

"devDependencies": {
    "babel-cli": "^6.18.0",
    "babel-core": "^6.18.2",
    "babel-istanbul": "^0.11.0",
    "babel-loader": "^6.2.8",
    "babel-plugin-react-html-attrs": "^2.0.0",
    "babel-plugin-syntax-decorators": "^6.13.0",
    "babel-plugin-transform-class-properties": "^6.19.0",
    "babel-plugin-transform-decorators-legacy": "^1.3.4",
    "babel-plugin-transform-es2015-modules-commonjs": "^6.18.0",
    "babel-polyfill": "^6.16.0",
    "babel-preset-es2015": "^6.18.0",
    "babel-preset-react": "^6.16.0",
    "babel-preset-stage-3": "^6.16.0",
    "browserify": "^13.3.0",
    "console-info": "0.0.4",
    "coveralls": "^2.11.15",
    "css-loader": "^0.26.1",
    "enzyme": "^2.6.0",
    "expect": "^1.20.2",
    "extract-text-webpack-plugin": "^1.0.1",
    "isparta-loader": "^2.0.0",
    "jsdom": "9.8.3",
    "jsdom-global": "2.1.0",
    "mocha": "^3.2.0",
    "mocha-lcov-reporter": "^1.2.0",
    "react": "^15.4.1",
    "react-addons-test-utils": "^15.4.1",
    "react-docgen": "^2.13.0",
    "react-dom": "^15.4.1",
    "react-styleguidist": "^4.6.3",
    "sass-loader": "^4.0.2",
    "sinon": "^1.17.6",
    "style-loader": "^0.13.1",
    "uglify-js": "^2.7.5",
    "webpack": "^1.13.3",
    "webpack-dev-middleware": "^1.8.4",
    "webpack-dev-server": "^1.16.2",
    "webpack-hot-middleware": "^2.13.2"
今天也遇到了同样的问题.

看起来像react-addons-test-utils已被弃用https://www.npmjs.com/package/react-addons-test-utils

你可以通过替换package.json中的那一行来逃脱

"react-test-renderer": "^15.5.4"

https://www.npmjs.com/package/react-test-renderer

希望有所帮助!

网友评论