how to change node version? “Your requested ”node“ version ”8“ doesn't match your global version ”10"

吃可爱长大的小学妹 提交于 2020-06-29 04:27:13

问题


It happen when I run in terminal firebase emulators:start

bellow all output

i  emulators: Starting emulators: functions, hosting
✔  hub: emulator hub started at ht tp://localhost:4400
⚠  Your requested "node" version "8" doesn't match your global version "10"
✔  functions: functions emulator started at ht tp://localhost:5001
i  hosting: Serving hosting files from: dist/spa-mat
✔  hosting: Local server: ht tp://localhost:5000
✔  hosting: hosting emulator started at http://localhost:5000
i  functions: Watching "/var/w ww/html/teachers/agnos2108-app.teachersnow-6391de281bf3/functions" for Cloud Functions...
✔  functions[sendEmailLogger]: http function initialized (ht tp://localhost:5001/teachernow-7082b/us-central1/sendEmailLogger).
✔  functions[sendMail]: http function initialized (ht tp://localhost:5001/teachernow-7082b/us-central1/sendMail).
✔  functions[payClbBNKTN2019ID]: http function initialized (ht tp://localhost:5001/teachernow-7082b/us-central1/payClbBNKTN2019ID).
✔  functions[payClbBNKTN2019]: http function initialized (ht tp://localhost:5001/teachernow-7082b/us-central1/payClbBNKTN2019).
✔  functions[payClbCCTN2019]: http function initialized (ht tp://localhost:5001/teachernow-7082b/us-central1/payClbCCTN2019).
✔  functions[payClbCDTN2019]: http function initialized (ht tp://localhost:5001/teachernow-7082b/us-central1/payClbCDTN2019).
i  functions[SchedulesOn]: function ignored because the database emulator does not exist or is not running.
i  functions[UsersOn]: function ignored because the database emulator does not exist or is not running.
i  functions[BankslipOn]: function ignored because the database emulator does not exist or is not running.
i  functions[sendWelcomeEmail]: function ignored because the auth emulator does not exist or is not running.
✔  emulators: All emulators started, it is now safe to connect.

回答1:


The message is not indicating an error. It's just letting you know that your package.json declares a target node version of 8, but you are using node 10 on your machine for emulation. It's not likely an issue.

If you want to get rid of the message, you should install node 8 instead of node 10 on your machine and use that instead.




回答2:


you can simply go to the node.js official website and download the version you want and install it. or you can use nvm to do that.

for nvm you have to install nvm from https://github.com/nvm-sh/nvm there you will have the a command to install nvm and after installation you have to restart your temrminal.

then use this command-

nvm install 12.16.1 

12.16.1 is the version you can change it with the version you want.




回答3:


After you have installed NVM as suggested above, you should check your package.json in your project directory and update the "engines": value to your global version of node which is 10 in your case.

example package.json

{
  "name": "functions",
  "description": "Cloud Functions for Firebase",
  "scripts": {
    "lint": "eslint .",
    "serve": "firebase emulators:start --only functions",
    "shell": "firebase functions:shell",
    "start": "npm run shell",
    "deploy": "firebase deploy --only functions",
    "logs": "firebase functions:log"
  },
  "engines": {
    "node": "8"
  },
  "dependencies": {
    "express": "^4.17.1",
    "firebase-admin": "^8.10.0",
    "firebase-functions": "^3.6.1"
  },
  "devDependencies": {
    "eslint": "^5.12.0",
    "eslint-plugin-promise": "^4.0.1",
    "firebase-functions-test": "^0.2.0"
  },
  "private": true
}

After you have updated the value engines: to 10 save and execute firebase emulators:start



来源:https://stackoverflow.com/questions/61489347/how-to-change-node-version-your-requested-node-version-8-doesnt-match-you

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!