4
respostas

TypeError: Cannot read property 'func' of undefined

Boa noite, Estou fazendo o curso, só que estou tomando erro abaixo. Já deletei 2 vezes o projeto recriei baixando como especificado na aula 3 Aguardo retorno.

Obrigado.

TypeError: Cannot read property 'func' of undefined
./node_modules/react-router/lib/PropTypes.js
E:/CursoReact2/instalura/node_modules/react-router/lib/PropTypes.js:8
   5 | 
   6 | var _react = require('react');
   7 | 
>  8 | var func = _react.PropTypes.func,
   9 |     object = _react.PropTypes.object,
  10 |     shape = _react.PropTypes.shape,
  11 |     string = _react.PropTypes.string;
View compiled
__webpack_require__
E:/CursoReact2/instalura/webpack/bootstrap ab32d23a3452c09599ab:678
  675 | };
  676 | 
  677 | // Execute the module function
> 678 | modules[moduleId].call(module.exports, module, module.exports, hotCreateRequire(moduleId));
  679 | 
  680 | // Flag the module as loaded
  681 | module.l = true;
View compiled
fn
E:/CursoReact2/instalura/webpack/bootstrap ab32d23a3452c09599ab:88
  85 |         console.warn("[HMR] unexpected require(" + request + ") from disposed module " + moduleId);
  86 |         hotCurrentParents = [];
  87 |     }
> 88 |     return __webpack_require__(request);
  89 | };
  90 | var ObjectFactory = function ObjectFactory(name) {
  91 |     return {
View compiled
./node_modules/react-router/lib/index.js
E:/CursoReact2/instalura/node_modules/react-router/lib/index.js:15
  12 |   }
  13 | });
  14 | 
> 15 | var _PropTypes = require('./PropTypes');
  16 | 
  17 | Object.defineProperty(exports, 'locationShape', {
  18 |   enumerable: true,
View compiled
__webpack_require__
E:/CursoReact2/instalura/webpack/bootstrap ab32d23a3452c09599ab:678
  675 | };
  676 | 
  677 | // Execute the module function
> 678 | modules[moduleId].call(module.exports, module, module.exports, hotCreateRequire(moduleId));
  679 | 
  680 | // Flag the module as loaded
  681 | module.l = true;
View compiled
fn
E:/CursoReact2/instalura/webpack/bootstrap ab32d23a3452c09599ab:88
  85 |         console.warn("[HMR] unexpected require(" + request + ") from disposed module " + moduleId);
  86 |         hotCurrentParents = [];
  87 |     }
> 88 |     return __webpack_require__(request);
  89 | };
  90 | var ObjectFactory = function ObjectFactory(name) {
  91 |     return {
View compiled
./src/componentes/Login.js
http://localhost:3000/static/js/bundle.js:47347:71
__webpack_require__
E:/CursoReact2/instalura/webpack/bootstrap ab32d23a3452c09599ab:678
  675 | };
  676 | 
  677 | // Execute the module function
> 678 | modules[moduleId].call(module.exports, module, module.exports, hotCreateRequire(moduleId));
  679 | 
  680 | // Flag the module as loaded
  681 | module.l = true;
View compiled
fn
E:/CursoReact2/instalura/webpack/bootstrap ab32d23a3452c09599ab:88
  85 |         console.warn("[HMR] unexpected require(" + request + ") from disposed module " + moduleId);
  86 |         hotCurrentParents = [];
  87 |     }
> 88 |     return __webpack_require__(request);
  89 | };
  90 | var ObjectFactory = function ObjectFactory(name) {
  91 |     return {
View compiled
./src/index.js
http://localhost:3000/static/js/bundle.js:47788:77
__webpack_require__
E:/CursoReact2/instalura/webpack/bootstrap ab32d23a3452c09599ab:678
  675 | };
  676 | 
  677 | // Execute the module function
> 678 | modules[moduleId].call(module.exports, module, module.exports, hotCreateRequire(moduleId));
  679 | 
  680 | // Flag the module as loaded
  681 | module.l = true;
View compiled
fn
E:/CursoReact2/instalura/webpack/bootstrap ab32d23a3452c09599ab:88
  85 |         console.warn("[HMR] unexpected require(" + request + ") from disposed module " + moduleId);
  86 |         hotCurrentParents = [];
  87 |     }
> 88 |     return __webpack_require__(request);
  89 | };
  90 | var ObjectFactory = function ObjectFactory(name) {
  91 |     return {
View compiled
0
http://localhost:3000/static/js/bundle.js:47872:18
__webpack_require__
E:/CursoReact2/instalura/webpack/bootstrap ab32d23a3452c09599ab:678
  675 | };
  676 | 
  677 | // Execute the module function
> 678 | modules[moduleId].call(module.exports, module, module.exports, hotCreateRequire(moduleId));
  679 | 
  680 | // Flag the module as loaded
  681 | module.l = true;
View compiled
./node_modules/ansi-regex/index.js.module.exports
E:/CursoReact2/instalura/webpack/bootstrap ab32d23a3452c09599ab:724
  721 | __webpack_require__.h = function() { return hotCurrentHash; };
  722 | 
  723 | // Load entry module and return exports
> 724 | return hotCreateRequire(0)(__webpack_require__.s = 0);
  725 | 
  726 | 
  727 | 
View compiled
(anonymous function)
http://localhost:3000/static/js/bundle.js:728:10
4 respostas

Fala Edvaldo, tudo bom? Você instalou a lib PropTypes no seu projeto? Se sim, a versão dela no package.json é igual a versão das libs react e react-dom?

Mario Souto Criei minha aplicação com o comando npm create-react-app minhaAplicacao, baixei react-router e react-router-dom conforme especificado na aula. Mesmo assim sem sucesso.

{
  "name": "instalura",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "react": "^16.3.2",
    "prop-types": "^15.6.1",
    "react-dom": "^16.3.2",
    "react-router": "^3.0.0",
    "react-router-dom": "^4.1.1",
    "react-scripts": "1.1.4"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject"
  }
}

Boa noite , Ainda estou travado com o problema acima, sendo assim, não consigo realizar as atividades das aulas do REACT. Aguardo retorno. Obrigado.

Oi Edvaldo, seu problema não é o mesmo que o Valter soluciona neste outro tópico?

https://cursos.alura.com.br/forum/topico-solucionando-typeerror-cannot-read-property-shape-of-undefined-64797