VueJS错误:无法找到模块“C:\@vue\cli-service\bin\vue-cli-service.js”

hs1ihplo  于 2023-04-07  发布在  Vue.js
关注(0)|答案(1)|浏览(310)

我在Visual Studio Code中有一个VueJS 2.x应用程序,我从3年前就没有碰过它。
今天我想构建它,所以我使用以下命令将我的nodejs版本设置为12.0.0:

NVM USE 12.0.0

然后删除node_modules文件夹和package-lock.json,并在终端中输入:

npm install

所有的工作没有错误,然后我键入:

npm run serve

我得到了以下错误:

> vue-cli-service serve

/c/Dev/TestVue/node_modules/.bin/vue-cli-service: line 2: sed: command not found
/c/Dev/TestVue/node_modules/.bin/vue-cli-service: line 2: dirname: command not found
/c/Dev/TestVue/node_modules/.bin/vue-cli-service: line 4: uname: command not found
internal/modules/cjs/loader.js:613
    throw err;
    ^

Error: Cannot find module 'C:\@vue\cli-service\bin\vue-cli-service.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:610:15)
    at Function.Module._load (internal/modules/cjs/loader.js:526:27)
    at Function.Module.runMain (internal/modules/cjs/loader.js:826:10)
    at internal/main/run_main_module.js:17:11
This is killing me because I remember it was working perfectly so not sure if maybe I'm not using the right versions of node.

下面是我的package.json的内容

{
  "name": "testapp",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "serve:local": "vue-cli-service serve --mode local",
    "serve": "vue-cli-service serve",
    "build": "vue-cli-service build",
    "lint": "vue-cli-service lint"
  },
  "dependencies": {
    "@grapecity/wijmo.all": "^5.20192.624",
    "@mdi/js": "^3.4.93",
    "@vue/cli": "^3.4.0",
    "axios": "^0.18.0",
    "chart.js": "^2.7.3",
    "core-js": "^2.6.5",
    "element-ui": "^2.4.11",
    "lodash": "^4.17.11",
    "momentjs": "^2.0.0",
    "pusher-js": "^4.4.0",
    "register-service-worker": "^1.6.1",
    "vue": "^2.6.6",
    "vue-chartjs": "^3.4.0",
    "vue-i18n": "^8.8.1",
    "vue-js-modal": "^1.3.31",
    "vue-on-click-outside": "^1.0.3",
    "vue-router": "^3.0.2",
    "vue-session": "^1.0.0",
    "vuedraggable": "^2.23.0",
    "vuex": "^3.1.0",
    "vuex-persistedstate": "^2.5.4"
  },
  "devDependencies": {
    "@vue/cli-plugin-babel": "^3.4.0",
    "@vue/cli-plugin-eslint": "^3.4.0",
    "@vue/cli-plugin-pwa": "^3.4.0",
    "@vue/cli-service": "^3.4.0",
    "@vue/eslint-config-prettier": "^3.0.5",
    "axios": "^0.18.0",
    "eslint-loader": "^2.1.2",
    "node-sass": "^4.14.1",
    "pug": "^2.0.3",
    "pug-plain-loader": "^1.0.0",
    "sass-loader": "^7.0.3",
    "vue-cli-plugin-axios": "0.0.4",
    "vue-cli-plugin-element": "^1.0.1",
    "vue-cli-plugin-i18n": "^0.5.1",
    "vue-template-compiler": "^2.6.6"
  }
}

相关问题