如何找出运行 npm run build 时犯的错误?
我对 VueJS 还很陌生。这是我的第一个应用程序,使用独立的服务器端应用程序创建 SPA。在将我的应用程序部署到共享主机上之前,我遇到了这个问题。简而言之,当我运行“npm run build”时,它返回一个错误,我什至不知道原因。这是我遇到的错误。
请帮我解决这个问题,我知道有jquery错误,但我认为这些不是问题
I'm quite new to this VueJS things. And this is my first App creating a SPA with separated server-side app. I faced the problem right before deploying my app on a shared hosting. Simply, when i run "npm run build", it return with an error in which i don't even know the cause. Here is the error i faced.
Please help me resolve this issues, i know there are jquery errors, but i think those are not the problems
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你有 es-lint 检查器。它会检查未使用的变量,以便在这些列出的组件中包含未使用的变量,例如 from 和 to。您应该从组件中删除这些变量。
You have es-lint checker. It checks unused vars so you have unused variables inside these listed components like from and to. You should remove these variable from your components.
这些错误来自您的 linter (可能是 eslint),这是一个旨在确保一致性和代码质量的工具:在您的情况下,它主要抱怨声明的变量未在代码中的其他任何地方使用,并且
$
是未定义(我猜你正在尝试使用 jquery,无论如何你都不应该在 vue 项目中执行此操作)在你发布的图像上,你有所有必要的信息:每个块的标题告诉你错误在哪个文件中(例如第一张图片中的
App.vue
),然后您可以通过行/列来精确定位需要调整的位置:)请注意,您可以配置 linter(应该是错误/警告/跳过的内容)覆盖(如果不存在则创建)项目根目录下的配置文件(例如,如果您使用 eslint,则可以创建一个
.eslintrc
文件)。请参阅官方文档的配置部分Those errors come from your linter (probably eslint) which is a tool designed to ensure consistence and code quality : in your case it mainly complains about declared variables that are not used anywhere else in your code and
$
being undefined (I guess you're trying to use jquery which you should not be doing in a vue project anyway)On the images you posted you have all necessary infos : the title of each block tells you in which file the error is (for example
App.vue
in the first image) and then you have line/column to locate precisely where you need to adjust :)Note that you can configure your linter (what should be error/warning/skipped out) overwriting (or creating if it doesn't exist) a config file at the root of your project (if you use eslint for example, you can create a
.eslintrc
file). See the config part of the official doc