Vue 创建项目 - 找不到模块“vue-loader-v16/package.json" [英] Vue create project - Cannot find module 'vue-loader-v16/package.json'

查看:1037
本文介绍了Vue 创建项目 - 找不到模块“vue-loader-v16/package.json"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过命令 npm install -g @vue/cli 全局安装了 vue-cli 并且我尝试通过命令 vue create examples-vue-2 创建新项目一切正常,直到我运行 npm run serve.这个命令给我一个错误找不到模块'vue-loader-v16/package.json'.

I have vue-cli installed globally via command npm install -g @vue/cli And I tried to create new project via command vue create examples-vue-2 Everything was ok until I run npm run serve. This command throws me an error Cannot find module 'vue-loader-v16/package.json'.

我使用的是 Win 10,npm 6.7.0,节点 11.15.0

I am on Win 10, npm 6.7.0, node 11.15.0

这是整个控制台日志

λ npm run serve                                                                                                                          
                                                                                                                                         
> examples-vue-2@0.1.0 serve c:\wamp64-3-2-0\www\examples-vue-2                                                                          
> vue-cli-service serve                                                                                                                  
                                                                                                                                         
 INFO  Starting development server...                                                                                                    
 ERROR  Error: Cannot find module 'vue-loader-v16/package.json'                                                                          
Error: Cannot find module 'vue-loader-v16/package.json'                                                                                  
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:668:15)                                                          
    at Function.Module._load (internal/modules/cjs/loader.js:591:27)                                                                     
    at Module.require (internal/modules/cjs/loader.js:723:19)                                                                            
    at require (internal/modules/cjs/helpers.js:14:16)                                                                                   
    at api.chainWebpack.webpackConfig (c:\wamp64-3-2-0\www\examples-vue-2\node_modules\@vue\cli-service\lib\config\base.js:114:23)       
    at webpackChainFns.forEach.fn (c:\wamp64-3-2-0\www\examples-vue-2\node_modules\@vue\cli-service\lib\Service.js:236:40)               
    at Array.forEach (<anonymous>)                                                                                                       
    at Service.resolveChainableWebpackConfig (c:\wamp64-3-2-0\www\examples-vue-2\node_modules\@vue\cli-service\lib\Service.js:236:26)    
    at Service.resolveWebpackConfig (c:\wamp64-3-2-0\www\examples-vue-2\node_modules\@vue\cli-service\lib\Service.js:240:48)             
    at PluginAPI.resolveWebpackConfig (c:\wamp64-3-2-0\www\examples-vue-2\node_modules\@vue\cli-service\lib\PluginAPI.js:132:25)         
npm ERR! code ELIFECYCLE                                                                                                                 
npm ERR! errno 1                                                                                                                         
npm ERR! examples-vue-2@0.1.0 serve: `vue-cli-service serve`                                                                             
npm ERR! Exit status 1                                                                                                                   
npm ERR!                                                                                                                                 
npm ERR! Failed at the examples-vue-2@0.1.0 serve script.                                                                                
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.                                       
                                                                                                                                         
npm ERR! A complete log of this run can be found in:                                                                                     
npm ERR!     C:\Users\vladi\AppData\Roaming\npm-cache\_logs\2020-08-19T08_20_22_147Z-debug.log   

package.json

package.json

{
  "name": "examples-vue-2",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "serve": "vue-cli-service serve",
    "build": "vue-cli-service build",
    "lint": "vue-cli-service lint"
  },
  "dependencies": {
    "core-js": "^3.6.5",
    "vue": "^3.0.0-0"
  },
  "devDependencies": {
    "@vue/cli-plugin-babel": "~4.5.0",
    "@vue/cli-plugin-eslint": "~4.5.0",
    "@vue/cli-service": "~4.5.0",
    "@vue/compiler-sfc": "^3.0.0-0",
    "babel-eslint": "^10.1.0",
    "eslint": "^6.7.2",
    "eslint-plugin-vue": "^7.0.0-0"
  },
  "eslintConfig": {
    "root": true,
    "env": {
      "node": true
    },
    "extends": [
      "plugin:vue/vue3-essential",
      "eslint:recommended"
    ],
    "parserOptions": {
      "parser": "babel-eslint"
    },
    "rules": {}
  },
  "browserslist": [
    "> 1%",
    "last 2 versions",
    "not dead"
  ]
}


                                    

非常感谢您的帮助.

推荐答案

解决方案在这个 vue-cli 包问题 https://github.com/vuejs/vue-cli/pull/5718您可能需要更新 npm 版本以安装缺少的包.

Solution is in this vue-cli package issue https://github.com/vuejs/vue-cli/pull/5718 You may need to update npm version to install missing package.

这篇关于Vue 创建项目 - 找不到模块“vue-loader-v16/package.json"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆