Error: Cannot find module 'cors'

后端 未结 4 1449
无人及你
无人及你 2021-02-19 00:07

I keep getting this error message below: I tried to find other stackoverflow post and articles but couldn\'t really sovle it. do any of you guys know what the problem is it?

4条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-19 00:42

    Need to install cors library. Use terminal and run "npm install cors" then use below in server.js file:

    var express = require('express')
    var cors = require('cors')
    var app = express()
    app.use(cors())
    

    Or, refer link: https://www.npmjs.com/package/cors

    Thanks,

提交回复
热议问题