How to correct this NODEMON error?

Asked

Viewed 210 times

-3

I wanted to ask for help to solve this problem. I am taking a course of React Native online but the instructor does not answer my questions. I am unable to find the problem. Follow the error:

    [nodemon] restarting due to changes...
[nodemon] starting `node src/index.js`
C:\Users\Administrador\APP-REACT\node_modules\express\lib\router\route.js:202
        throw new Error(msg);
        ^

Error: Route.post() requires a callback function but got a [object Undefined]
    at Route.<computed> [as post] (C:\Users\Administrador\APP-REACT\node_modules\express\lib\router\route.js:202:15)
    at Function.proto.<computed> [as post] (C:\Users\Administrador\APP-REACT\node_modules\express\lib\router\index.js:510:19)
    at Object.<anonymous> (C:\Users\Administrador\APP-REACT\src\routes\TaskRoutes.js:6:8)
    at Module._compile (internal/modules/cjs/loader.js:1138:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
    at Module.load (internal/modules/cjs/loader.js:986:32)
    at Function.Module._load (internal/modules/cjs/loader.js:879:14)
    at Module.require (internal/modules/cjs/loader.js:1026:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (C:\Users\Administrador\APP-REACT\src\index.js:5:21)
    at Module._compile (internal/modules/cjs/loader.js:1138:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
    at Module.load (internal/modules/cjs/loader.js:986:32)
    at Function.Module._load (internal/modules/cjs/loader.js:879:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
    at internal/main/run_main_module.js:17:47
[nodemon] app crashed - waiting for file changes before starting... 

If you need more details, just say so. I’ll pass on the code images. Thank you.

images

inserir a descrição da imagem aqui

inserir a descrição da imagem aqui

inserir a descrição da imagem aqui

inserir a descrição da imagem aqui

inserir a descrição da imagem aqui

  • 1

    Could post the code?

  • Hello, friend. What code do I need to post? I’m a beginner in React.

  • Taskroutes.js and the controller associated with it, if you have one.

  • Friend, I put some images. I don’t know what callback function you’re referring to.

  • I added an answer, could check if it solves the problem?

1 answer

0


This error is not related to nodemon.

nodemon failed to load the modules due to build failure.

Have an error in file Taskvalidation line 7.

Missing to add double quotes (") in your string.

where there is:

return res.status(400).json({error: é obriga});

should be:

return res.status(400).json({error: "macaddress é obrigatório"});
  • Friend, the eternal mistake of beginner =D. It worked here. Thank you very much.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.