简体   繁体   English

命令“npm run build”以代码 1 退出

[英]The command "npm run build" exited with code 1

Visual studio will not allow me to publish my ASP.NET core 2 project anymore, creating the following output Visual Studio 将不再允许我发布我的 ASP.NET Core 2 项目,创建以下输出

12/21/2018 1:44:52 PM System.AggregateException: One or more errors occurred. 12/21/2018 1:44:52 PM System.AggregateException:发生一个或多个错误。 ---> System.Exception: Build failed. ---> System.Exception:构建失败。 Check the Output window for more details.检查“输出”窗口以获取更多详细信息。 --- End of inner exception stack trace --- at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken) at Microsoft.VisualStudio.Web.Publish.PublishService.VsWebProjectPublish.<>c__DisplayClass43_0.b__2() at System.Threading.Tasks.Task`1.InnerInvoke() at System.Threading.Tasks.Task.Execute() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.ApplicationCapabilities.Publish.ViewModel.ProfileSelectorViewModel.d__127.MoveNext() ---> (Inner Exception #0) System.Exception: Build failed. --- 内部异常堆栈跟踪结束 --- 在 System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) 在 System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken) 在 Microsoft.VisualStudio.Web。 Publish.PublishService.VsWebProjectPublish.<>c__DisplayClass43_0.b__2() at System.Threading.Tasks.Task`1.InnerInvoke() at System.Threading.Tasks.Task.Execute() --- 从先前位置开始的堆栈跟踪结束异常被抛出 --- 在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务) 在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务) 在 Microsoft.VisualStudio.ApplicationCapabilities.Publish.ViewModel.ProfileSelectorViewModel.d__127.MoveNext () --->(内部异常 #0)System.Exception:构建失败。 Check the Output window for more details.<---检查输出窗口以获取更多详细信息。<---

=================== ===================

I've checked other threads regarding NPM exit with code 1 but neither one seems relevant to me.我已经用代码 1 检查了有关 NPM exit 的其他线程,但似乎没有一个与我相关。

I was able to publish project once and the second time I've tried - Got the error.我能够一次和第二次尝试发布项目 - 出现错误。 No configuration was changed.没有更改配置。

EDIT编辑

Npm Error Log: Npm 错误日志:

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Users\\asmirnov\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'run',
1 verbose cli   'build' ]
2 info using npm@6.4.1
3 info using node@v8.11.4
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle v7@0.1.0~prebuild: v7@0.1.0
6 info lifecycle v7@0.1.0~build: v7@0.1.0
7 verbose lifecycle v7@0.1.0~build: unsafe-perm in lifecycle true
8 verbose lifecycle v7@0.1.0~build: PATH: C:\Users\asmirnov\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\dev\DigiSign\DigiSign2018_UAT\SimplySignWeb\v7\ClientApp\node_modules\.bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\iCLS\;C:\Program Files\Intel\Intel(R) Management Engine Components\iCLS\;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\UCRT\;C:\Program Files\Intel\UCRT\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Windows\system32\config\systemprofile\.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm\;C:\Program Files (x86)\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\130\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\130\Tools\Binn\ManagementStudio\;C:\Program Files\dotnet\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\PuTTY\;C:\Program Files (x86)\AMD\ATI.ACE\Core-Static;C:\Program Files\nodejs\;C:\Program Files\Git\cmd;C:\Program Files (x86)\Toshiba\Bluetooth Toshiba Stack\sys\;C:\Program Files (x86)\Toshiba\Bluetooth Toshiba Stack\sys\x64\;C:\Program Files (x86)\Rico Suter\NSwagStudio\;C:\Users\asmirnov\.dotnet\tools;C:\Users\asmirnov\AppData\Roaming\npm;C:\ProgramData\asmirnov\atom\bin;C:\Users\asmirnov\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\asmirnov\AppData\Local\Programs\Fiddler
9 verbose lifecycle v7@0.1.0~build: CWD: C:\dev\DigiSign\DigiSign2018_UAT\SimplySignWeb\v7\ClientApp
10 silly lifecycle v7@0.1.0~build: Args: [ '/d /s /c', 'node scripts/build.js' ]
11 silly lifecycle v7@0.1.0~build: Returned: code: 1  signal: null
12 info lifecycle v7@0.1.0~build: Failed to exec build script
13 verbose stack Error: v7@0.1.0 build: `node scripts/build.js`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (C:\Users\asmirnov\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\index.js:301:16)
13 verbose stack     at emitTwo (events.js:126:13)
13 verbose stack     at EventEmitter.emit (events.js:214:7)
13 verbose stack     at ChildProcess.<anonymous> (C:\Users\asmirnov\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack     at emitTwo (events.js:126:13)
13 verbose stack     at ChildProcess.emit (events.js:214:7)
13 verbose stack     at maybeClose (internal/child_process.js:925:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
14 verbose pkgid v7@0.1.0
15 verbose cwd C:\dev\DigiSign\DigiSign2018_UAT\SimplySignWeb\v7\ClientApp
16 verbose Windows_NT 6.1.7601
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\asmirnov\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run" "build"
18 verbose node v8.11.4
19 verbose npm  v6.4.1
20 error code ELIFECYCLE
21 error errno 1
22 error v7@0.1.0 build: `node scripts/build.js`
22 error Exit status 1
23 error Failed at the v7@0.1.0 build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

I was able to figure out what the problem is by rinning build in a console, it pointed me to the problem in one of the components that wasn't compiling:通过在控制台中运行构建,我能够找出问题所在,它指出了其中一个未编译组件的问题:

在此处输入图像描述

In my case I had a dash " - " in the file path, in one of the folder names.在我的例子中,我在文件路径中的一个文件夹名称中有一个破折号“-”。 Renamed the folder and it worked.重命名文件夹,它工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用 Github 发布 React+dotnet 核心应用程序引发错误 MSB3073 的操作:命令“npm run build”退出,代码为 1 - Publishing React+dotnet core application using Github Actions throwing error MSB3073: The command “npm run build” exited with code 1 该命令以代码1退出 - The command exited with code 1 发布 ASP.NET 核心应用程序:命令“npm install”退出,代码为 9009 - Release of ASP.NET core App: The command "npm install" exited with code 9009 使用 React 构建 ASP.NET Core 应用程序时,如何修复“命令“npm install”退出并显示代码 1”错误? - How to fix 'The command "npm install" exited with code 1' error when building the ASP.NET Core app with React? 命令“ nuget pack…”以代码1退出 - The command “nuget pack…” exited with code 1 NuGet退出,代码为-1073741502-.Net构建失败 - NuGet exited with code -1073741502 - .Net Build Failing 仅使用“ dotnet run”运行“ npm run build” - run “npm run build” with only “dotnet run” 如何在 ASP.NET Core 中构建之前运行特定的 NPM 命令? - How do I run a specific NPM command before build in ASP.NET Core? 构建错误MSB600“tsc.exe”退出代码2 - Build error MSB600 “tsc.exe” exited with code 2 MSBuild退出,出现代码1错误 - MSBuild exited with code 1 error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM