无法运行带Webpack的Vuejs:找不到组件依赖项

时间:2017-07-19 12:59:38

标签: npm webpack vue.js vuejs2 vue-component

为什么我不能使用webpack运行我的Vue脚本?我收到了这个错误。

ERROR  Failed to compile with 11 errors                                19.32.28

These dependencies were not found:

* @/components/naven in ./src/main.js
* @/components/navtab in ./src/main.js
* @/components/artikel in ./src/main.js
* @/components/navbtm in ./src/main.js
* @/components/hero in ./src/main.js
* @/components/btmdata in ./src/main.js
* @/components/navbtn in ./src/main.js
* @/components/foot in ./src/main.js
* @/components/social in ./src/main.js
* @/components/contenthome in ./src/main.js
* @/components/Content-home in ./src/router/index.js

To install them, you can run: npm install --save @/components/naven 
@/components/navtab @/components/artikel @/components/navbtm 
@/components/hero @/components/btmdata @/components/navbtn 
@/components/foot @/components/social @/components/contenthome 
@/components/Content-home
> Listening at http://localhost:8080
ppabcd@ppabcd:~/server/vue-test$

我在浏览器中收到了这个结果:

Cannot GET /

1 个答案:

答案 0 :(得分:-1)

我认为你应该更新" vue"版本与最新版本。

或试试这个

import ComponentName from 'components/ComponentPage'

当您使用最新版本(@/)时,您必须添加vue: ^2.4.2

但是,我猜您的错误日志意味着"您的代码是最新版本但是,您的vue是旧版本"。