npm - 无法使用 Webpack : component dependencies were not found 运行 Vuejs

标签 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 /

最佳答案

我认为你应该用最新版本更新“vue”版本。

或者试试这个

import ComponentName from 'components/ComponentPage'

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

但是,我猜你的错误日志的意思是“你的代码是最新版本,但是你的 vue 是旧版本”。

关于npm - 无法使用 Webpack : component dependencies were not found 运行 Vuejs,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45191401/

相关文章:

javascript - 如何将 vue 项目提供给网络上的其他计算机

node.js - 从 npm 脚本运行 docker 不起作用

asp.net - TypeScript - [后续属性声明必须具有相同类型] - 对相同类型定义的多个引用

javascript - 带有 Gradle 和 Webpack 的 Spring Boot

node.js - 将 node_modules 安装到 vendor

reactjs - 我如何在 Heroku 上安装 NPM --force

webpack - UglifyJS 和 webpack v5

javascript - Vue watch[fat arrow scope] 提供了错误的 this 上下文

带有 <video><source> 标签的 Vue.js Vite 构建错误

css - 如何在没有硬编码高度的情况下使用 Vue.js 转换?