首页 > 解决方案 > Visual Studio 中的构建后 Vue 应用程序给出“命令 npm run build exited with code 1”

问题描述

我正在 Visual Studio 中构建一个 Vue 应用程序,运行构建后,我留下了错误:The command npm run build exited with code 1. 我注意到它发生在我的 Vue 应用程序的后期构建中,代码如下:

<Exec WorkingDirectory="$(OutDir)" Command="$(PostBuildEvent)"/>

这是我的整个后期构建脚本:

<PropertyGroup>
<PostBuildEventDependsOn></PostBuildEventDependsOn>
</PropertyGroup>
<Target
  Name="PostBuildEvent"
  Condition="'$(PostBuildEvent)' != '' and ('$(RunPostBuildEvent)' != 'OnOutputUpdated' or '$(_AssemblyTimestampBeforeCompile)' != '$(_AssemblyTimestampAfterCompile)')"
  DependsOnTargets="$(PostBuildEventDependsOn)">

<Exec WorkingDirectory="$(OutDir)" Command="$(PostBuildEvent)"/>

我希望将一个包 javascript 文件放在我的 Vue 应用程序的“dist”文件夹中。谢谢您的帮助。

标签: javascripthtmlvue.jswebpackvuejs2

解决方案


只需以管理员身份运行 VS。


推荐阅读