0

我正在尝试将 griddle-react 1.0.3 与 react 16.2.0 一起使用,但出现以下错误“Typeerror: Cannot read property 'string' of undefined”。如何解决此错误?我应该使用烤盘 0.8.1 来响应 16.2.0 还是这是我正在使用的正确组合?

W20181002-15:38:55.733(5)? (STDERR) TypeError: Cannot read property 'string' 
of undefined
W20181002-15:38:55.734(5)? (STDERR)     at Object.<anonymous> 
(D:\react_projects\backstage-check\node_modules\griddle- 
react\dist\module\components\ColumnDefinition.js:42:33)
W20181002-15:38:55.735(5)? (STDERR)     at Module._compile 
(module.js:652:30)
W20181002-15:38:55.735(5)? (STDERR)     at Object.Module._extensions..js 
(module.js:663:10)
W20181002-15:38:55.736(5)? (STDERR)     at Module.load (module.js:565:32)
W20181002-15:38:55.737(5)? (STDERR)     at tryModuleLoad (module.js:505:12)
W20181002-15:38:55.738(5)? (STDERR)     at Function.Module._load 
(module.js:497:3)
W20181002-15:38:55.738(5)? (STDERR)     at Module.require (module.js:596:17)
W20181002-15:38:55.739(5)? (STDERR)     at require 
(internal/module.js:11:18)
W20181002-15:38:55.740(5)? (STDERR)     at Object.<anonymous> 
(D:\react_projects\backstage-check\node_modules\griddle- 
react\dist\module\components\index.js:15:25)
W20181002-15:38:55.741(5)? (STDERR)     at Module._compile 
(module.js:652:30)
W20181002-15:38:55.741(5)? (STDERR)     at Object.Module._extensions..js 
(module.js:663:10)
W20181002-15:38:55.742(5)? (STDERR)     at Module.load (module.js:565:32)
W20181002-15:38:55.743(5)? (STDERR)     at tryModuleLoad (module.js:505:12)
W20181002-15:38:55.743(5)? (STDERR)     at Function.Module._load 
(module.js:497:3)
W20181002-15:38:55.744(5)? (STDERR)     at Module.require (module.js:596:17)
W20181002-15:38:55.744(5)? (STDERR)     at require 
(internal/module.js:11:18)
W20181002-15:38:55.745(5)? (STDERR)     at Object.<anonymous> 
(D:\react_projects\backstage-check\node_modules\griddle- 
react\dist\module\index.js:31:19)
W20181002-15:38:55.746(5)? (STDERR)     at Module._compile 
(module.js:652:30)
W20181002-15:38:55.747(5)? (STDERR)     at Object.Module._extensions..js 
(module.js:663:10)
W20181002-15:38:55.748(5)? (STDERR)     at Module.load (module.js:565:32)
W20181002-15:38:55.748(5)? (STDERR)     at tryModuleLoad (module.js:505:12)
W20181002-15:38:55.749(5)? (STDERR)     at Function.Module._load 
(module.js:497:3)
4

1 回答 1

0

尝试更新到最新版本。我打赌你安装了npm i --save react-griddle@beta(不要使用测试版)。并使用npm i --save react-griddle.

原因是 propType,它是反应核心的一部分。然后在较新的版本(现在很旧)中,它被移到了它自己的包中。

这里捕获来说明这一点。

老的: 截图来自 2019-03-13 02-00-29

较新的版本: 截图来自 2019-03-13 02-00-13

捕获显示转译的代码。

如果不清楚,请查看文档! https://reactjs.org/docs/typechecking-with-proptypes.html

于 2019-03-13T01:15:15.627 回答