【问题标题】:jscodeshift PropTypes to proptypes skipping all files in node modulesjscodeshift PropTypes 到 proptypes 跳过节点模块中的所有文件
【发布时间】:2020-05-09 04:44:25
【问题描述】:

我对后端反应设置完全陌生。一切都很顺利,直到我开始造型......我得到了这个

TypeError: Cannot read property 'object' of undefined
./node_modules/radium/lib/components/style.js
node_modules/radium/lib/components/style.js:23
  20 | displayName: 'Style',
  21 | 
  22 | propTypes: {
> 23 |   radiumConfig: _react.PropTypes.object,
     | ^  24 |   rules: _react.PropTypes.object,
  25 |   scopeSelector: _react.PropTypes.string
  26 | },

谷歌搜索后,我登陆了 jscodeshift...所以我跑了

% jscodeshift --extensions js -t react-codemod/transforms/React-PropTypes-to-prop-types.js  node_modules/radium/lib/components/ --explicit-require=false
Processing 3 files...
Spawning 3 workers...
Sending 1 files to free worker...
Sending 1 files to free worker...
Sending 1 files to free worker...
All done.
Results:
0 errors
0 unmodified
3 skipped
0 ok
Time elapsed: 0.770seconds

我用谷歌搜索了更多,其他人遇到了导入问题,例如材料 UI、代码中没有返回,或者除了 js 文件。我什至删除了节点模块并重新安装了 npm 无济于事。我似乎无法为我的问题找到任何解决方案。

这是我的 package.JSON 依赖项...

"dependencies": {
    "@testing-library/jest-dom": "^4.2.4",
    "@testing-library/react": "^9.5.0",
    "@testing-library/user-event": "^7.2.1",
    "@types/react-burger-menu": "^2.6.1",
    "jscodeshift": "^0.9.0",
    "prop-types": "^15.7.2",
    "radium": "^0.26.0",
    "react": "^15.6.2",
    "react-burger-menu": "^1.12.0",
    "react-dom": "^15.6.2",
    "react-scripts": "3.4.1",
    "yarn": "^1.22.4"
  },

非常感谢任何帮助。 ps:我愿意完全重置整个项目。

【问题讨论】:

    标签: node.js npm package.json react-proptypes jscodeshift


    【解决方案1】:

    重新安装一切解决了这个问题。

    我认为我出错的地方可能是: 1.安装或重装版本不兼容的包,即react-dom和react的不同版本等。 2. 一次尝试太多事情......

    对未来 google 人的建议:慢慢来,尤其是在转换为 TS 时。确保基本的反应应用程序正在运行。然后在迁移到 TS 时逐步转换或添加您需要的其他模块。

    一切顺利!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-11-29
      • 2018-11-08
      • 1970-01-01
      • 2018-09-17
      • 2016-10-17
      • 2021-04-11
      • 2016-07-04
      相关资源
      最近更新 更多