windows下使用nvm安装nodejs的版本问题

最近学习了一个开源项目,用的是vue2+vue CLI 版本算是比较老了,其中有一个依赖node-sass 使用高版本的node安装各种问题,尤其是node-sass还依赖python的运行环境进行编译。开始使用的是nvm的最新版本 安装的node版本,但是高版本的nvm在安装很低版本的node的时候可能存在找不到的问题。

安装nvm

下载 windows版本的nvm  https://github.com/coreybutler/nvm-windows/releases
-- 下载安装版本,会让你指定 nvm的安装位置和 node的安装位置。如果要安装老版本的依赖,nvm的版本不要太高,最终经过几次重试,用了nvm的


-- 查看可安装版本
nvm list available

-- 安装指定版本
 nvm install 
 
-- 切换版本
 nvm use <version>

-- 查看已安装版本
nvm list

-- 卸载版本
nvm uninstall

-- 设置国内镜像
nvm node_mirror https://npmmirror.com/mirrors/node/
nvm npm_mirror https://npmmirror.com/mirrors/npm/

-- 相关环境变量
NVM_HOME:nvm安装目录
NVM_SYMLINK:nodejs安装目录


兼容性问题(我就是被坑死在nvm版本上的)

在这里插入图片描述

我的nvm默认用的是最新的
在这里插入图片描述
后面切换为 如下版本就可以安装了。
在这里插入图片描述
附录package.json的配置文件:

{
  "name": "vue-element-admin",
  "version": "4.2.1",
  "description": "A magical vue admin. An out-of-box UI solution for enterprise applications. Newest development stack of vue. Lots of awesome features",
  "author": "Pan <panfree23@gmail.com>",
  "license": "MIT",
  "scripts": {
    "dev": "vue-cli-service serve",
    "build:prod": "vue-cli-service build",
    "build:stage": "vue-cli-service build --mode staging",
    "preview": "node build/index.js --preview",
    "lint": "eslint --ext .js,.vue src",
    "test:unit": "jest --clearCache && vue-cli-service test:unit",
    "test:ci": "npm run lint && npm run test:unit",
    "svgo": "svgo -f src/icons/svg --config=src/icons/svgo.yml",
    "new": "plop"
  },
  "husky": {
    "hooks": {
      "pre-commit": "lint-staged"
    }
  },
  "lint-staged": {
    "src/**/*.{js,vue}": [
      "eslint --fix",
      "git add"
    ]
  },
  "keywords": [
    "vue",
    "admin",
    "dashboard",
    "element-ui",
    "boilerplate",
    "admin-template",
    "management-system"
  ],
  "repository": {
    "type": "git",
    "url": "git+https://github.com/PanJiaChen/vue-element-admin.git"
  },
  "bugs": {
    "url": "https://github.com/PanJiaChen/vue-element-admin/issues"
  },
  "dependencies": {
    "@form-create/element-ui": "^2.5.1",
    "@vue/composition-api": "^1.0.0-rc.6",
    "ant-design-vue": "^1.7.8",
    "axios": "0.21.2",
    "babel-preset-env": "^1.7.0",
    "body-parser": "^1.19.1",
    "clipboard": "^2.0.6",
    "core-js": "^2.6.12",
    "driver.js": "0.9.5",
    "echarts": "^5.0.2",
    "element-ui": "^2.13.2",
    "file-saver": "^2.0.5",
    "fuse.js": "3.4.4",
    "intro.js": "^3.4.0",
    "js-base64": "^3.6.0",
    "js-cookie": "2.2.0",
    "jsonlint": "1.6.3",
    "less-loader": "^6.2.0",
    "lib-flexible": "^0.3.2",
    "lodash": "^4.17.21",
    "moment": "^2.29.1",
    "normalize.css": "7.0.0",
    "nprogress": "0.2.0",
    "path-to-regexp": "2.4.0",
    "pl-table": "^2.7.5",
    "px2rem-loader": "^0.1.9",
    "screenfull": "4.2.0",
    "semver": "^7.3.5",
    "showdown": "1.9.1",
    "sortablejs": "1.8.4",
    "sql-formatter": "^4.0.2",
    "v-distpicker": "^1.2.6",
    "vue": "2.6.10",
    "vue-clipboard2": "^0.3.1",
    "vue-count-to": "1.0.13",
    "vue-echarts": "^6.0.0-rc.4",
    "vue-good-table": "^2.21.11",
    "vue-infinite-scroll": "^2.0.2",
    "vue-introjs": "^1.3.2",
    "vue-json-excel": "^0.3.0",
    "vue-router": "3.0.2",
    "vue-splitpane": "^1.0.4",
    "vue-virtual-scroller": "^1.0.10",
    "vue2-ace-editor": "^0.0.15",
    "vuedraggable": "^2.20.0",
    "vuex": "3.1.0",
    "x-data-spreadsheet": "^1.1.4",
    "xlsx": "^0.17.4"
  },
  "devDependencies": {
    "@babel/core": "7.0.0",
    "@babel/register": "7.0.0",
    "@vue/cli-plugin-babel": "3.5.3",
    "@vue/cli-plugin-eslint": "^3.9.1",
    "@vue/cli-plugin-unit-jest": "3.5.3",
    "@vue/cli-service": "3.5.3",
    "@vue/test-utils": "1.0.0-beta.29",
    "autoprefixer": "^9.7.6",
    "babel-core": "7.0.0-bridge.0",
    "babel-eslint": "10.0.1",
    "babel-jest": "23.6.0",
    "chalk": "2.4.2",
    "chokidar": "2.1.5",
    "compression-webpack-plugin": "^1.1.12",
    "connect": "3.6.6",
    "eslint": "5.15.3",
    "eslint-plugin-vue": "5.2.2",
    "html-webpack-plugin": "3.2.0",
    "husky": "1.3.1",
    "lint-staged": "8.1.5",
    "mockjs": "1.0.1-beta3",
    "node-sass": "^4.14.1",
    "plop": "2.3.0",
    "runjs": "^4.3.2",
    "sass-loader": "^7.1.0",
    "script-ext-html-webpack-plugin": "2.1.3",
    "script-loader": "0.7.2",
    "serve-static": "^1.13.2",
    "svg-sprite-loader": "4.1.3",
    "svgo": "1.2.0",
    "vue-particles": "^1.0.9",
    "vue-template-compiler": "2.6.10"
  },
  "engines": {
    "node": ">=8.9",
    "npm": ">= 3.0.0"
  },
  "browserslist": [
    "> 1%",
    "last 2 versions"
  ]
}



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

壬戌知秋

您的打赏将是我最大的鼓励感谢

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值