mac下使用vue create 項目名稱 建立項目後沒法運行ERROR Error: Cannot find module 'vue-template-compiler/package.json'

mac下使用vue create 項目名稱 建立項目後沒法運行啓動問題vue

promote:vue_pro wangxinqiang$ npm run servenode

> vue_pro@0.1.0 serve /Users/wangxinqiang/Desktop/@vue:cli3/vue_pro
> vue-cli-service servewebpack

 INFO  Starting development server...
 ERROR  Error: Cannot find module 'vue-template-compiler/package.json'
Error: Cannot find module 'vue-template-compiler/package.json'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:603:15)
    at Function.Module._load (internal/modules/cjs/loader.js:529:25)
    at Module.require (internal/modules/cjs/loader.js:658:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at api.chainWebpack.webpackConfig (/usr/local/lib/node_modules/@vue/cli-service/lib/config/base.js:73:32)
    at webpackChainFns.forEach.fn (/usr/local/lib/node_modules/@vue/cli-service/lib/Service.js:227:40)
    at Array.forEach (<anonymous>)
    at Service.resolveChainableWebpackConfig (/usr/local/lib/node_modules/@vue/cli-service/lib/Service.js:227:26)
    at Service.resolveWebpackConfig (/usr/local/lib/node_modules/@vue/cli-service/lib/Service.js:231:48)
    at PluginAPI.resolveWebpackConfig (/usr/local/lib/node_modules/@vue/cli-service/lib/PluginAPI.js:138:25)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! vue_pro@0.1.0 serve: `vue-cli-service serve`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the vue_pro@0.1.0 serve script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.web

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/wangxinqiang/.npm/_logs/2019-07-14T01_59_08_811Z-debug.logvue-cli

解決方法一:
1.更新最新npm
npm install npm -g
2.卸載以前vue-cli版本(若是是2.x版本)
npm uninstall -g vue-cli
3.安裝新版本(3.x版本)
npm install -g @vue/clinpm

解決方法二:json

因爲我使用的文件夾名字「@vue/cli」致使mac上新建項目沒法運行,所以換一個普通名字便可api

由於這個名字在vscode上被格式化成,致使沒法讀取ui

ok,此刻問題處理完畢this

相關文章
相關標籤/搜索