npm 启动vue 项目失败!

启动命令:npm run serve
 npm run serve

> bim-project@4.2.0 serve
> vue-cli-service serve

node:internal/modules/cjs/loader:903
  throw err;
  ^

Error: Cannot find module '@vue/cli-shared-utils'
Require stack:
- E:\document\1111-vscodeworkspace\ClASS-CODE\03-Django实战\btu-font\node_modules\@vue\cli-service\bin\vue-cli-service.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:900:15)
    at Function.Module._load (node:internal/modules/cjs/loader:745:27)
    at Module.require (node:internal/modules/cjs/loader:972:19)
    at require (node:internal/modules/cjs/helpers:88:18)
    at Object.<anonymous> (E:\document\1111-vscodeworkspace\ClASS-CODE\03-Django实战\btu-font\node_modules\@vue\cli-service\bin\vue-cli-service.js:4:19)
    at Module._compile (node:internal/modules/cjs/loader:1083:30)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1112:10)
    at Module.load (node:internal/modules/cjs/loader:948:32)
    at Function.Module._load (node:internal/modules/cjs/loader:789:14)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:72:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'E:\\document\\1111-vscodeworkspace\\ClASS-CODE\\03-Django实战\\btu-font\\node_modules\\@vue\\cli-service\\bin\\vue-cli-service.js'
  ]
}
npm ERR! code 1
npm ERR! path E:\document\1111-vscodeworkspace\ClASS-CODE\03-Django实战\btu-font
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c "vue-cli-service serve"

npm ERR! A complete log of this run can be found in:
npm ERR!     E:\Program Files\nodejs\node_cache\_logs\2020-11-25T02_12_07_832Z-debug.log
  1. npm install ok,然而启动依旧失败,显示code: 'MODULE_NOT_FOUND',

  2. cnpm install 同理!

  3. node.js软件选择repair ,还是老样子

  4. 安装 丢失的特定包,(这里面是 @vue/cli-shared-utils ),安装失败 显示

    npm ERR! code 128
    npm ERR! command failed
    npm ERR! command git ls-remote ssh://git@github.com/vue/cli-shared-utils.git
    npm ERR! ERROR: Repository not found.
    npm ERR! fatal: Could not read from remote repository.
    npm ERR!
    npm ERR! Please make sure you have the correct access rights
    npm ERR! and the repository exists.
    
    npm ERR! A complete log of this run can be found in:
    npm ERR!     E:\Program Files\nodejs\node_cache\_logs\2020-11-25T03_03_23_120Z-debug.log
    
  5. npm updatecnpm update全部卡住,没反应。

大神救我!!!
似乎cnpm install vue/cli-shared-utils 有点用,但还是它一直在转呀!感觉清空不妙!

cnpm install vue/cli-shared-utils
- [@vue/cli-shared-utils] install  from git github:vue/cli-shared-utils, may be very slow, please keep patience
\ [0/1] Installing @vue/cli-shared-utilsdownload tarball failed: GET https://github.com/vue/cli-shared-utils/tarball/master response 404 status, try to clone repository now.
git clone https://github.com/vue/cli-shared-utils.git E:\document\1111-vscodeworkspace\ClASS-CODE\03-Django实战\btu-font\node_modules\.tmp\45493e2b-578c-4a28-92d0-bfe86e7ab3fe
Cloning into 'E:\document\1111-vscodeworkspace\ClASS-CODE\03-Django实战\btu-font\node_modules\.tmp\45493e2b-578c-4a28-92d0-bfe86e7ab3fe'...

在这里插入图片描述

方法3

  1. 彻底删除node_modules文件夹(时间有点慢)
  2. npm install
  3. 启动 npm start

启动成功!!

 DONE  Compiled successfully in 7775ms
 
  App running at:
  - Local:   http://localhost:8081
  - Network: http://192.168.6.250:8081


     

总结:

  1. npm install
  2. 不行的话完全删除node_modules文件夹再进行第一步
Logo

前往低代码交流专区

更多推荐