简体   繁体   中英

ReferenceError: crossOriginIsolated is not defined whenever I run "npm run server"

Whenever I run "npm run server" in the terminal I get this error

This is my package.json file:

{
  "scripts": {
    "start": "node backend/server.js",
    "server": "node backend/server.js"
  },
  "dependencies": {
    "colors": "^1.4.0",
    "dotenv": "^16.0.1",
    "express": "^4.18.1",
    "mongoose": "^6.4.2"
  },
  "devDependencies": {
    "nodemon": "^2.0.18"
  }
}

This is my server.js file"

crossOriginIsolated.log('Hello World')

Did you mean to do:

console.log("Hello World")

instead of

crossOriginIsolated.log('Hello World')

Maybe Intellisense made you enter the wrong thing.

Answered: The server.js file had the wrong code, I had a plugin that auto adds code and I missed it here:

crossOriginIsolated.log('Hello World')
->
console.log('Hello World')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM