Error msb3073 the command npm run build exited with code 1

I am getting the below error while publishing the React+dotnet core application using Github Actions. I am using the GitHub self-hosted runners on my windows server 2016. npm ERR! code ELIFECYCLE ...

I am getting the below error while publishing the React+dotnet core application using Github Actions. I am using the GitHub self-hosted runners on my windows server 2016.

npm ERR! code ELIFECYCLE
  npm ERR! errno 1
  npm ERR! ptrx_backoffice@0.1.0 build: `react-scripts build`
  npm ERR! Exit status 1
  npm ERR! 
  npm ERR! Failed at the ptrx_backoffice@0.1.0 build script.
  npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
  
  npm ERR! A complete log of this run can be found in:
  npm ERR!  
  C:UsersAdministratorAppDataRoamingnpm-cache_logs2021-02-11T15_54_47_880Z-debug.log
D:aayushptrx_backofficeptrx_backofficePTRX_BackOffice.csproj(49,5): error MSB3073: The command "npm run build" exited with code 1.
Error: Process completed with exit code 1.

Logfile 2021-02-11T15_54_47_880Z-debug.log output is as below. I have tried deleting node-modules, cleaned cache using npm but it doesn’t seem an issue with NPM as it’s clearly saying in the logs that this is not related to NPM. Please let me know if someone can help on it.

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   'C:\Program Files\nodejs\node.exe',
1 verbose cli   'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js',
1 verbose cli   'run',
1 verbose cli   'build'
1 verbose cli ]
2 info using npm@6.13.4
3 info using node@v12.16.0
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle ptrx_backoffice@0.1.0~prebuild: ptrx_backoffice@0.1.0
6 info lifecycle ptrx_backoffice@0.1.0~build: ptrx_backoffice@0.1.0
7 verbose lifecycle ptrx_backoffice@0.1.0~build: unsafe-perm in lifecycle true
8 verbose lifecycle ptrx_backoffice@0.1.0~build: PATH: C:Program Filesnodejsnode_modulesnpmnode_modulesnpm-lifecyclenode-gyp-bin;D:aayushptrx_backofficeptrx_backofficeClientAppnode_modules.bin;C:Program Files (x86)Common FilesOracleJavajavapath;C:Program Files (x86)PHPv7.1;C:Windowssystem32;C:Windows;C:WindowsSystem32Wbem;C:WindowsSystem32WindowsPowerShellv1.0;C:Program Files (x86)Microsoft SQL Server100ToolsBinn;C:Program FilesMicrosoft SQL Server100ToolsBinn;C:Program FilesMicrosoft SQL Server100DTSBinn;C:Program Files (x86)Microsoft SQL Server100ToolsBinnVSShellCommon7IDE;C:Program Files (x86)Microsoft Visual Studio 9.0Common7IDEPrivateAssemblies;C:Program Files (x86)Microsoft SQL Server100DTSBinn;C:Program FilesMicrosoftWeb Platform Installer;C:Program Filesdotnet;C:Program Files (x86)dotnet;C:UsersAdministratorAppDataRoamingnpm;C:Program FilesMicrosoft SQL Server120DTSBinn;C:Program FilesMicrosoft SQL ServerClient SDKODBC110ToolsBinn;C:Program Files (x86)Microsoft SQL Server120ToolsBinn;C:Program FilesMicrosoft SQL Server120ToolsBinn;C:Program Files (x86)Microsoft SQL Server120ToolsBinnManagementStudio;C:Program Files (x86)Microsoft SQL Server120DTSBinn;C:Program FilesGitcmd;C:Program Filesnodejs;C:Apache24bin;C:UsersAdministrator.dnxbin;C:Program FilesMicrosoft DNXDnvm;C:Program FilesMicrosoft SQL Server130ToolsBinn;C:Program FilesPuTTY;C:pythonScripts;C:python;C:Program FilesScripts;C:Program Files;C:UsersAdministratorAppDataRoamingnpm;C:Apache24bin;C:Program FilesJetBrainsPyCharm Community Edition 2020.1bin;;C:UsersAdministrator.dotnettools
9 verbose lifecycle ptrx_backoffice@0.1.0~build: CWD: D:aayushptrx_backofficeptrx_backofficeClientApp
10 silly lifecycle ptrx_backoffice@0.1.0~build: Args: [ '/d /s /c', 'react-scripts build' ]
11 silly lifecycle ptrx_backoffice@0.1.0~build: Returned: code: 1  signal: null
12 info lifecycle ptrx_backoffice@0.1.0~build: Failed to exec build script
13 verbose stack Error: ptrx_backoffice@0.1.0 build: `react-scripts build`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (C:Program Filesnodejsnode_modulesnpmnode_modulesnpm-lifecycleindex.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:321:20)
13 verbose stack     at ChildProcess.<anonymous> (C:Program Filesnodejsnode_modulesnpmnode_modulesnpm-lifecyclelibspawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:321:20)
13 verbose stack     at maybeClose (internal/child_process.js:1021:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
14 verbose pkgid ptrx_backoffice@0.1.0
15 verbose cwd D:aayushptrx_backofficeptrx_backofficeClientApp
16 verbose Windows_NT 6.3.9600
17 verbose argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "run" "build"
18 verbose node v12.16.0
19 verbose npm  v6.13.4
20 error code ELIFECYCLE
21 error errno 1
22 error ptrx_backoffice@0.1.0 build: `react-scripts build`
22 error Exit status 1
23 error Failed at the ptrx_backoffice@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 ]

Well, the publish is now working, but asp.net core is now not find the npm.

Exception:

System.AggregateException: One or more errors occurred. (One or more errors occurred. (Failed to start 'npm'. To resolve this:.

[1] Ensure that 'npm' is installed and can be found in one of the PATH directories.
    Current PATH enviroment variable is: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
    Make sure the executable is in one of those directories, or update your PATH.

[2] See the InnerException for further details of the cause.))
 ---> System.AggregateException: One or more errors occurred. (Failed to start 'npm'. To resolve this:.

[1] Ensure that 'npm' is installed and can be found in one of the PATH directories.
    Current PATH enviroment variable is: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
    Make sure the executable is in one of those directories, or update your PATH.

[2] See the InnerException for further details of the cause.)
 ---> System.InvalidOperationException: Failed to start 'npm'. To resolve this:.

[1] Ensure that 'npm' is installed and can be found in one of the PATH directories.
    Current PATH enviroment variable is: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
    Make sure the executable is in one of those directories, or update your PATH.

[2] See the InnerException for further details of the cause.
 ---> System.ComponentModel.Win32Exception (2): No such file or directory
   at System.Diagnostics.Process.ForkAndExecProcess(String filename, String[] argv, String[] envp, String cwd, Boolean redirectStdin, Boolean redirectStdout, Boolean redirectStderr, Boolean setCredentials, UInt32 userId, UInt32 groupId, UInt32[] groups, Int32& stdinFd, Int32& stdoutFd, Int32& stderrFd, Boolean usesTerminal, Boolean throwOnNoExec)
   at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo)
   at System.Diagnostics.Process.Start()
   at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
   at Microsoft.AspNetCore.NodeServices.Npm.NpmScriptRunner.LaunchNodeProcess(ProcessStartInfo startInfo)
   --- End of inner exception stack trace ---
   at Microsoft.AspNetCore.NodeServices.Npm.NpmScriptRunner.LaunchNodeProcess(ProcessStartInfo startInfo)
   at Microsoft.AspNetCore.NodeServices.Npm.NpmScriptRunner..ctor(String workingDirectory, String scriptName, String arguments, IDictionary`2 envVars)
   at Microsoft.AspNetCore.SpaServices.AngularCli.AngularCliMiddleware.StartAngularCliServerAsync(String sourcePath, String npmScriptName, ILogger logger)
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
   at System.Threading.Tasks.Task`1.get_Result()
   at Microsoft.AspNetCore.SpaServices.AngularCli.AngularCliMiddleware.<>c.<Attach>b__2_0(Task`1 task)
   at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
   at System.Threading.Tasks.Task.<>c.<.cctor>b__274_0(Object obj)
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
   at System.Threading.Tasks.Task`1.get_Result()
   at Microsoft.AspNetCore.SpaServices.Extensions.Util.TaskTimeoutExtensions.WithTimeout[T](Task`1 task, TimeSpan timeoutDelay, String message)
   at Microsoft.AspNetCore.SpaServices.Extensions.Proxy.SpaProxy.PerformProxyRequest(HttpContext context, HttpClient httpClient, Task`1 baseUriTask, CancellationToken applicationStoppingToken, Boolean proxy404s)
   at Microsoft.AspNetCore.Builder.SpaProxyingExtensions.<>c__DisplayClass2_0.<<UseProxyToSpaDevelopmentServer>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
   at IdentityServer4.Hosting.IdentityServerMiddleware.Invoke(HttpContext context, IEndpointRouter router, IUserSession session, IEventService events)
   at IdentityServer4.Hosting.MutualTlsTokenEndpointMiddleware.Invoke(HttpContext context, IAuthenticationSchemeProvider schemes)
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at IdentityServer4.Hosting.BaseUrlMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.MigrationsEndPointMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.DatabaseErrorPageMiddleware.Invoke(HttpContext httpContext)
   at Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.DatabaseErrorPageMiddleware.Invoke(HttpContext httpContext)
   at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
InvalidOperationException: Failed to start 'npm'. To resolve this:. [1] Ensure that 'npm' is installed and can be found in one of the PATH directories. Current PATH enviroment variable is: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin Make sure the executable is in one of those directories, or update your PATH. [2] See the InnerException for further details of the cause.
Microsoft.AspNetCore.NodeServices.Npm.NpmScriptRunner.LaunchNodeProcess(ProcessStartInfo startInfo)
Microsoft.AspNetCore.NodeServices.Npm.NpmScriptRunner..ctor(string workingDirectory, string scriptName, string arguments, IDictionary<string, string> envVars)
Microsoft.AspNetCore.SpaServices.AngularCli.AngularCliMiddleware.StartAngularCliServerAsync(string sourcePath, string npmScriptName, ILogger logger)

and yes, node and npm are sure installed and accessable via normal terminal in the container etc.

Содержание

  1. Error: Command «npm run build» exited with 1 #6515
  2. <>’s edit
  3. Area: Vercel CLI Name: arduinoprojectportugal Previous Page: Not Specified
  4. React App Web site created using create-react-app my-ppa.vercel.app
  5. npm run build exited with return -1 #126
  6. Comments
  7. Footer
  8. «npm install» exited with code -1 on dotnet publish #9593
  9. Comments
  10. Steps to reproduce
  11. Expected behavior
  12. Actual behavior
  13. Additional info
  14. Environment data
  15. Команда «npm run build — —prod» завершилась с ошибкой кода 1
  16. 6 ответов
  17. Вопрос №56379 от пользователя Сергей в проекте «RSS агрегатор»

Error: Command «npm run build» exited with 1 #6515

<>’s edit

Area: Vercel CLI
Name: arduinoprojectportugal
Previous Page: Not Specified

21:08:31.746 Retrieving list of deployment files.
21:08:33.927 Downloading 10 deployment files.
21:08:34.049 Analyzing source code.
21:08:35.558 Installing build runtime.
21:08:38.317 Build runtime installed: 2.759s
21:08:41.187 Looking up build cache.
21:08:41.944 Build cache found. Downloading.
21:08:44.295 Build cache downloaded [25.80 MB]: 2351.317ms
21:08:45.452 Detected package.json
21:08:45.452 Installing dependencies.
21:08:49.290 npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.json was generated for lockfileVersion@2. I’ll try to do my best with it!
21:08:56.158 npm WARN @testing-library/user-event@12.8.3 requires a peer of @testing-library/dom@>=7.21.4 but none is installed. You must install peer dependencies yourself.
21:08:56.168 npm WARN tsutils@3.21.0 requires a peer of typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta but none is installed. You must install peer dependencies yourself.
21:08:56.178 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules/fsevents):
21:08:56.178 npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted <«os»:»darwin»,»arch»:»any»>(current: <«os»:»linux»,»arch»:»x64″>)
21:08:56.187 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/watchpack-chokidar2/node_modules/fsevents):
21:08:56.187 npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted <«os»:»darwin»,»arch»:»any»>(current: <«os»:»linux»,»arch»:»x64″>)
21:08:56.195 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/webpack-dev-server/node_modules/fsevents):
21:08:56.195 npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted <«os»:»darwin»,»arch»:»any»>(current: <«os»:»linux»,»arch»:»x64″>)
21:08:56.197 up to date in 10.19s
21:08:57.260 145 packages are looking for funding
21:08:57.260 run npm fund for details
21:08:57.525 Running «npm run build»
21:08:57.797 > buda-velho@0.1.0 build /vercel/path0
21:08:57.797 > react-scripts build
21:08:59.564 Could not find a required file.
21:08:59.564 Name: index.html
21:08:59.565 Searched in: /vercel/path0/public
21:08:59.578 npm ERR! code ELIFECYCLE
21:08:59.578 npm ERR! errno 1
21:08:59.582 npm ERR! buda-velho@0.1.0 build: react-scripts build
21:08:59.582 npm ERR! Exit status 1
21:08:59.582 npm ERR!
21:08:59.582 npm ERR! Failed at the buda-velho@0.1.0 build script.
21:08:59.582 npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
21:08:59.600 npm ERR! A complete log of this run can be found in:
21:08:59.600 npm ERR! /vercel/.npm/_logs/2021-07-24T20_08_59_583Z-debug.log
21:08:59.617 Error: Command «npm run build» exited with 1

answer from vercel:

Thank you for getting in touch, I’m sorry you’re having difficulty using the Vercel platform.

To help us provide assistance, please provide more context on the issue being faced by answering the questions below:

Once we have answers to the above questions, we will do our best to provide you with the assistance required to resolve your issue.

Matthew Sweeney
▲ Director of Customer Success at Vercel

I am expereincing the following behaviour, first run npx create-react-app my-app

then, use cd my-app

And everything goes ok

after a few changes on the code, the following errrors start appearing:

21:08:31.746 Retrieving list of deployment files.
21:08:33.927 Downloading 10 deployment files.
21:08:34.049 Analyzing source code.
21:08:35.558 Installing build runtime.
21:08:38.317 Build runtime installed: 2.759s
21:08:41.187 Looking up build cache.
21:08:41.944 Build cache found. Downloading.
21:08:44.295 Build cache downloaded [25.80 MB]: 2351.317ms
21:08:45.452 Detected package.json
21:08:45.452 Installing dependencies.
21:08:49.290 npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.json was generated for lockfileVersion@2. I’ll try to do my best with it!
21:08:56.158 npm WARN @testing-library/user-event@12.8.3 requires a peer of @testing-library/dom@>=7.21.4 but none is installed. You must install peer dependencies yourself.
21:08:56.168 npm WARN tsutils@3.21.0 requires a peer of typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta but none is installed. You must install peer dependencies yourself.
21:08:56.178 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules/fsevents):
21:08:56.178 npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted <«os»:»darwin»,»arch»:»any»>(current: <«os»:»linux»,»arch»:»x64″>)
21:08:56.187 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/watchpack-chokidar2/node_modules/fsevents):
21:08:56.187 npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted <«os»:»darwin»,»arch»:»any»>(current: <«os»:»linux»,»arch»:»x64″>)
21:08:56.195 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/webpack-dev-server/node_modules/fsevents):
21:08:56.195 npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted <«os»:»darwin»,»arch»:»any»>(current: <«os»:»linux»,»arch»:»x64″>)
21:08:56.197 up to date in 10.19s
21:08:57.260 145 packages are looking for funding
21:08:57.260 run npm fund for details
21:08:57.525 Running «npm run build»
21:08:57.797 > buda-velho@0.1.0 build /vercel/path0
21:08:57.797 > react-scripts build
21:08:59.564 Could not find a required file.
21:08:59.564 Name: index.html
21:08:59.565 Searched in: /vercel/path0/public
21:08:59.578 npm ERR! code ELIFECYCLE
21:08:59.578 npm ERR! errno 1
21:08:59.582 npm ERR! buda-velho@0.1.0 build: react-scripts build
21:08:59.582 npm ERR! Exit status 1
21:08:59.582 npm ERR!
21:08:59.582 npm ERR! Failed at the buda-velho@0.1.0 build script.
21:08:59.582 npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
21:08:59.600 npm ERR! A complete log of this run can be found in:
21:08:59.600 npm ERR! /vercel/.npm/_logs/2021-07-24T20_08_59_583Z-debug.log
21:08:59.617 Error: Command «npm run build» exited with 1

Also if I run this comand on the terminal: vercel version vercel CLI 23.0.1

npx create-react-app my-app cd my-app vercel

the default app runs well with the react logo rotating, linke in this this page:

React App Web site created using create-react-app my-ppa.vercel.app

but if I make a simple change. I cant run the app anymore, What should I do?

Beta Was this translation helpful? Give feedback.

Источник

npm run build exited with return -1 #126

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.1.1 (node_modulessanenode_modulesfsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.2: wanted <«os»:»darwin»,»arch»:»any»>(current: <«os»:»win32″,»arch»:»x64″>)
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_moduleschokidarnode_modulesfsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.2: wanted <«os»:»darwin»,»arch»:»any»>(current: <«os»:»win32″,»arch»:»x64″>)
npm WARN prettier-loader@2.0.0 requires a peer of webpack@^3.0.0 but none was installed.
npm WARN demo@0.0.1 No repository field.

error MSB3073: The command «npm install» exited with code -1.

The text was updated successfully, but these errors were encountered:

You can ignore the fsevents dependency because it is macOS (or iOS) only.

As for the prettier-loader, that isn’t used in this project, so I’m guessing you added it yourself. Did you add it in dependencies or devDependencies ?

Did you run a fresh npm install on the project to get started? It seems like it is not finding any of the dependencies.

Closing this because of no activity. Think this is done now. Feel free to open up another issue if you encounter problems.

© 2023 GitHub, Inc.

You can’t perform that action at this time.

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.

Источник

«npm install» exited with code -1 on dotnet publish #9593

Steps to reproduce

  • Update SPA templates with dotnet new —install Microsoft.DotNet.Web.Spa.ProjectTemplates::2.0.0 .
  • Create a new SPA app with dotnet new angular .
  • Run dotnet restore in the root.
  • Run npm i in the ClientApp .
  • Run dotnet publish -c release -r win-x64 in the root.

Expected behavior

Get a published app.

Actual behavior

Get the error MSB3073: The command «npm install» exited with code -1. .

Additional info

App successfully run in debug mode in VS code. Only publish doesn’t work.

Environment data

dotnet —info output:

dotnet publish -c release -r win-x64 -v diag output (>38MB):
https://yadi.sk/i/bt6ATlRG3Z8sAc

pt.csproj source code:

netcoreapp2.0 true Latest false ClientApp $(DefaultItemExcludes);$(SpaRoot)node_modules** false

‘%(FullPath)’)» Exclude=»@(ResolvedFileToPublish)»> %(DistFiles.Identity) PreserveNewest

The text was updated successfully, but these errors were encountered:

Tried to fool dotnet and write as an instruction. Still get the same error (partially) — error MSB3073: The command «npm install & exit 0» exited with code -1. .

Updated node to 8.11.3 . No errors now.

Hey,
I have here the current vs code version with .net core and node 12, already tried with node 10 and I can reproduce the issue, any ideas how this can be fixed?

Hi,
try and edit your project file by removing the section below:

Then save, re-publish again.

Well, the publish is now working, but asp.net core is now not find the npm.

and yes, node and npm are sure installed and accessable via normal terminal in the container etc.

Источник

Команда «npm run build — —prod» завершилась с ошибкой кода 1

Я занимаюсь разработкой Asp.Net Core 2 и Angular 5 в Visual Studio 2017.

Когда я собираюсь опубликовать свой проект, в окне списка ошибок появляется ошибка « Команда« npm run build — —prod »с кодом 1 ».
Я создал проект с угловым интерфейсом командной строки в ASP.NET Core 2 угловой шаблон ссылка и все было хорошо, и проект запущен и опубликован правильно.
Через некоторое время я не знаю, что именно происходит, потому что проект не публикуется.

В файле npm-debug.log

6 ответов

Получил ту же ошибку, моя среда:

И ничто упомянутое выше не помогло. Просто зайдите в «. ClientApp» // Angular-CLI project и запустите

Тогда вы увидите реальные ошибки — значит, просто, у вас есть ошибки в коде, так что исправьте угловой код пользовательского интерфейса, и он будет прекрасно работать :).

Возможно в командной строке NodeJS версия Visual Studio старая. В выводе вашей команды мы можем увидеть:

Error: The command «npm install» exited with code 1

Добавьте переменную среды, щелкните правой кнопкой мыши на этом ПК

  • Перейти к свойствам
  • Перейти на вкладку «Дополнительно»
  • Нажмите переменную среды
  • В разделе «Пользовательские переменные» нажмите «Создать», введите имя переменной «Путь» и значение C:UsersUserAppDataRoamingnpm
  • Еще один — в разделе Пользовательские переменные нажмите new, введите имя переменной «Path» и значение C:Program Filesnodejs

Если переменная Path уже существует, вы можете отредактировать эту переменную, добавив новый путь (значение) путем разделения ; .

npm run build:prod — —prod

Чтобы увидеть фактическую ошибку / ошибки, которые привели к сбою вашей сборки. Обратите внимание, что команда имеет prod в качестве флага.

Проверьте это возможно у вас проблема с нехваткой памяти

Попробуйте запустить: ng build «prod» и посмотрите, что является настоящей ошибкой.

Источник

Вопрос №56379 от пользователя Сергей в проекте «RSS агрегатор»

Добрый день, не понимаю, как подключить Bootstrap через Webpack, пишу в терминале команду npm install bootstrap — выдает ошибку. И можно поподробнее описать процесс создания страницы

Сергей, без вывода ошибки трудно чем-то помочь.

Процесс создания страницы примерно следующий:

вам нужно создать файл index.html, поместить его в корень приложения. В этом файле у вас должна быть необходимая вам базовая разметка. Вы можете как сверстать все статические элементы, так и создать их через js. Затем, используя этот файл как шаблон, подключить с помощью плагина webpack html-webpack-plugin в него стили и скрипты. За подробностями обращайтесь к документации плагина.

при сборке webpacka возникает ошибка

ERROR in main Module not found: Error: Can’t resolve ‘./src’ in ‘/Users/Sergei/frontend-project-lvl3’ resolve ‘./src’ in ‘/Users/Sergei/frontend-project-lvl3’ using description file: /Users/Sergei/frontend-project-lvl3/package.json (relative path: .) Field ‘browser’ doesn’t contain a valid alias configuration using description file: /Users/Sergei/frontend-project-lvl3/package.json (relative path: ./src) no extension Field ‘browser’ doesn’t contain a valid alias configuration /Users/Sergei/frontend-project-lvl3/src doesn’t exist .js Field ‘browser’ doesn’t contain a valid alias configuration /Users/Sergei/frontend-project-lvl3/src.js doesn’t exist .json Field ‘browser’ doesn’t contain a valid alias configuration /Users/Sergei/frontend-project-lvl3/src.json doesn’t exist .wasm Field ‘browser’ doesn’t contain a valid alias configuration /Users/Sergei/frontend-project-lvl3/src.wasm doesn’t exist as directory /Users/Sergei/frontend-project-lvl3/src doesn’t exist

Почему при сборке он ругается на папку src , до которой мы еще не дошли?

Сергей, по умолчанию вебпак ищет точку входа в src/index.js. Вам нужно или создать такой файл по этому пути, или использовать заготовку, указанную в первом шаге.

Использовал заготовку, указанную в первом шаге, до файла babel.config.js, далее опять ошибка -Module not found: Error: Can’t resolve ‘babel-loader’ in ‘/Users/Sergei/frontend-project-lvl3’

Сергей, что значит «до файла babel.config.js»?

Роман, добрый день! с зависимостями разобрался, вебпак собирается. Но при деплое выходят ошибки: npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.json was generated for lockfileVersion@2. I’ll try to do my best with it! ERROR in main 10:36:06.191 Module not found: Error: Can’t resolve ‘./src’ in ‘/vercel/path0’ webpack 5.47.1 compiled with 1 error in 116 ms Error: Command «npm run build» exited with 1

Сергей, только задеплоил ваш проект, сборка проходит нормально. При настройке деплоя в Vercel обратите внимание на то, какую папку вы указываете в качестве ваших исходников и какую папку указываете в качестве папки с собранными файлами. Посмотрел ваш проект, у вас много ненужных зависимостей. Используйте заготовку, можете её скачать и разрабатывать в ней – там настроено окружение.

Роман, правильно ли я понимаю, что источниками будет папка dist, а папка с собранными файлами — src. Но на гит я не коммитил папку dist и как указать ее через vercel?

пытаюсь настроить линтер, после инициализации и запуска выводит ошибки /Users/Sergei/frontend-project-lvl3/.eslintrc.js 1:1 error ‘module’ is not defined no-undef

/Users/Sergei/frontend-project-lvl3/babel.config.js 1:1 error ‘module’ is not defined no-undef

/Users/Sergei/frontend-project-lvl3/dist/main.js 17:9 error ‘unused_webpack_module’ is defined but never used no-unused-vars 17:34 error ‘webpack_exports_‘ is defined but never used no-unused-vars 17:55 error ‘webpack_require‘ is defined but never used no-unused-vars 27:9 error ‘unused_webpack_module’ is defined but never used no-unused-vars 27:34 error ‘webpack_exports‘ is defined but never used no-unused-vars 27:55 error ‘webpack_require‘ is defined but never used no-unused-vars 37:9 error ‘unused_webpack_module’ is defined but never used no-unused-vars 37:34 error ‘webpack_exports‘ is defined but never used no-unused-vars 37:55 error ‘webpack_require‘ is defined but never used no-unused-vars 47:9 error ‘module’ is defined but never used no-unused-vars 47:17 error ‘webpack_exports‘ is defined but never used no-unused-vars 47:38 error ‘webpack_require‘ is defined but never used no-unused-vars 57:9 error ‘module’ is defined but never used no-unused-vars 67:9 error ‘unused_webpack_module’ is defined but never used no-unused-vars 67:34 error ‘webpack_exports‘ is defined but never used no-unused-vars 67:55 error ‘webpack_require‘ is defined but never used no-unused-vars 77:9 error ‘module’ is defined but never used no-unused-vars 87:9 error ‘module’ is defined but never used no-unused-vars 97:9 error ‘module’ is defined but never used no-unused-vars 107:9 error ‘module’ is defined but never used no-unused-vars 107:17 error ‘unused_webpack_exports’ is defined but never used no-unused-vars 107:43 error ‘webpack_require‘ is defined but never used no-unused-vars 117:9 error ‘module’ is defined but never used no-unused-vars 127:9 error ‘module’ is defined but never used no-unused-vars 205:15 error ‘webpack_exports_’ is assigned a value but never used no-unused-vars

/Users/Sergei/frontend-project-lvl3/webpack.config.js 1:27 error ‘require’ is not defined no-undef 3:1 error ‘module’ is not defined no-undef 4:9 error ‘process’ is not defined no-undef

добавлял изменения в .eslintrc.js, ничего не помогает

Сергей, собранные файлы лежат в dist, исходный код — в src. Vercel делает сборку (npm run build) при деплое, так появляется dist. Всё это описано в документации к Vercel.

Судя по выводу ошибки, вы настойчиво игнорируете моё предложение использовать заготовку.

Добрый день, Роман! задеплоить удалось только через терминал (почитал документацию на vercel), теперь нельзя деплоить через сам vercel (вопрос, как вернуть все обратно). Зависимости все взял из заготовки (файл package.json). Как появляется Dist я понимаю, я не понимаю, почему у меня деплой проходит только через терминал, и почему не настраивается линтер

Сергей, возьмите заготовку полностью, в ней настроено всё окружение, сделайте npm install – после этого можете писать свой код в ./src .

В настройках проекта на vercel вам нужно изменить output directory на dist, и source code directory на ./src .

Источник

RRS feed

  • Remove From My Forums
  • Question

  • Error MSB3073 The command «»C:Usersusername.nugetpackagesgulp.js1.0.2build..toolsnpm.cmd» install gulp gulp-util —save-dev» exited with code 1. projectname C:Users\username.nugetpackagesgulp.js1.0.2buildgulp.js.targets 12

All replies

  • Hi Anvesh.Reddy

    Welcome to MSDN forum.

    After my check, this error is something about windows can’t find npm.cmd.

    The error exists in guid.js.targets-line12, let’s check its content in line12:

    <Exec Condition=" !Exists('$(NodeModulesGulp)')" Command="$(MSBuildThisFileDirectory)..toolsnpm.cmd install gulp gulp-util --save-dev" WorkingDirectory="$(SolutionDir)" />

    So this is a msbuild task named Exec. It will call the cmd.exe to run the command. So we can say we open cmd.exe, and type command: 

    npm.cmd install gulp gulp-util --save-dev

    But the windows system can’t find the npm.cmd though it actually locates there. Which will return an error File Not Found and The system can’t find the path specified.

    So you can try the workarounds from these similar issues to resolve this issue:

    npm-The system can’t find the path specified

    node.js npm error message — system cannot find the path specified

    gulp command not found — error after installing gulp 

    Once when you successfully run npm.cmd command in cmd.exe, you can build your project successfully after that. Hope it helps.

    If my reply is helpful or not, any feedback would be expected.

    Best Regards

    Lance


    MSDN Community Support
    Please remember to click «Mark as Answer» the responses that resolved your issue, and to click «Unmark as Answer» if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to
    MSDN Support, feel free to contact MSDNFSF@microsoft.com.

  • Hi Lance,

    Thanks for reply

    do I need to install node js software to run this «npm.cmd install gulp gulputil
    savedev» command.

    Thanks

  • Hi Anvesh.Reddy,

    Sorry for the delay. Yes, the installation of the
    node,js and npm
    is one of the prerequisites.

    But it seems that it needs more configuration so that the npm can work well in windows system. For this, you can check similar topics online like what I share above to resolve the
    File not found issue for npm

    My suggestions for this issue if you’re still stuck at File not found…

    1.You can install the gulp package manually following
    this guide, and copy the node_moudles folder from where the gulp package locates into solution directory. 

    2.Since this nuget package haven’t been updated after 2014/3/22, I’m not sure if it works for VS2015 and higher, I suggest you can
    contact the owner to seek for help or report this issue in
    github.

    Any update please feel free to contact me. And if my reply is helpful to locate the cause of the issue and work around it, you can consider marking it as answer. 

    Sincerely

    Lance


    MSDN Community Support
    Please remember to click «Mark as Answer» the responses that resolved your issue, and to click «Unmark as Answer» if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to
    MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Proposed as answer by

      Monday, July 15, 2019 8:59 AM

Jun 25, 2018
4 min read |
React,
ASP.Net Core,
.Net,
Docker

I started a new project this week, a SPA written in React with an ASP.Net Core 2.1.1 backend hosted in a Docker container. This is the tale of how I got all those pieces working together.

The running code from this article can be seen on GitHub.

Creating a ASP.Net Core project with React from a dotnet template

Microsoft has helpfully created a template for this very scenario.

dotnet new react -o react-app
cd react-app

I created the app from the template and changed directory. From there I ran:

The result was a failed build with the following error:

error NU1605: Detected package downgrade: Microsoft.AspNetCore.SpaServices.Extensions from 2.1.1 to 2.1.0. Reference the package directly from the project to select a different version.

The .csproj-file contained these references:

<ItemGroup>
   <PackageReference Include="Microsoft.AspNetCore.App" />
   <PackageReference Include="Microsoft.AspNetCore.SpaServices.Extensions" Version="2.1.0" />
</ItemGroup>

The Microsoft.AspNetCore.App meta-package is new from ASP.Net 2.1.1. This package should only be reference without a version number, thus needing no change when the version number is upped by Microsoft.

No such luck with Microsoft.AspNetCore.SpaServices.Extensions which only works with .Net Core version 2.1.0. I removed this reference:

<ItemGroup>
   <PackageReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>

And tried dotnet run again:

Running React in an ASP.Net Core Docker-container

The app ran locally, now was the time to create a Docker container for testing and publishing.

Creating Dockerfile

Avid readers of this blog will know that I use multi-stage Dockerfiles for my containers. I’m basing these on the official dotnet images supplied by Microsoft.

You’ll also remember that we need a .dockerignore-file to prevent locally built items to be copied.

Creating a Dockerfile for building and running a regular ASP.Net Core 2.1.1 app is easy:

FROM microsoft/dotnet:2.1.301-sdk AS builder
WORKDIR /source

COPY *.csproj .
RUN dotnet restore

COPY ./ ./

RUN dotnet publish "./react-app.csproj" --output "./dist" --configuration Release --no-restore

FROM microsoft/dotnet:2.1.1-aspnetcore-runtime
WORKDIR /app
COPY --from=builder /source/dist .
EXPOSE 80
ENTRYPOINT ["dotnet", "react-app.dll"]

And .dockerignore is equally simple:

Building an image with the React-app from the template using this Dockerfile, resulted in:

docker build -t hjerpbakk/react-app .

react-app -> /source/bin/Release/netcoreapp2.1/react-app.Views.dll
  /bin/sh: 2: /tmp/tmp9dfbab16bdf54855b9b5da0e68821afa.exec.cmd: npm: not found
/source/react-app.csproj(34,5): error MSB3073: The command "npm install" exited with code 127.
The command '/bin/sh -c dotnet publish "./react-app.csproj" --output "./dist" --configuration Release --no-restore' returned a non-zero code: 1

I needed to install Node.js in order to build react. Thus, the Dockerfile needed to be:

FROM microsoft/dotnet:2.1.301-sdk AS builder
WORKDIR /source

RUN curl -sL https://deb.nodesource.com/setup_10.x |  bash -
RUN apt-get install -y nodejs

COPY *.csproj .
RUN dotnet restore

COPY ./ ./

RUN dotnet publish "./react-app.csproj" --output "./dist" --configuration Release --no-restore

FROM microsoft/dotnet:2.1.1-aspnetcore-runtime
WORKDIR /app
COPY --from=builder /source/dist .
EXPOSE 80
ENTRYPOINT ["dotnet", "react-app.dll"]

But the build did not succeed yet.

Getting Node.js to restore correct versions of NPM modules

With the updated Dockerfile, the command docker build -t hjerpbakk/react-app . gave the following error now:

  > react_app@0.1.0 build /source/ClientApp
  > react-scripts build
  
  sh: 1: react-scripts: not found
  npm ERR! file sh
  npm ERR! code ELIFECYCLE
  npm ERR! errno ENOENT
  npm ERR! syscall spawn
  npm ERR! react_app@0.1.0 build: react-scripts build
  npm ERR! spawn ENOENT
  npm ERR!
  npm ERR! Failed at the react_app@0.1.0 build script.
  npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
  
  npm ERR! A complete log of this run can be found in:
  npm ERR!     /root/.npm/_logs/2018-06-25T11_26_23_802Z-debug.log
/source/react-app.csproj(35,5): error MSB3073: The command "npm run build" exited with code 1.
The command '/bin/sh -c dotnet publish "./react-app.csproj" --output "./dist" --configuration Release --no-restore' returned a non-zero code: 1

This was not enough information for me to debug this issue. I needed to run commands using bash in the partially built container.

To do this, make a note of the last stage of the build process that succeeded. In this case, it was the dotnet publish "./react-app.csproj" --output "./dist" --configuration Release --no-restore command that failed. Scrolling up in the output, we find the id of the stage on which this command was run:

Bash could then run in the container using the following command:

docker run --rm -it 2d7680490d55 bash -il

This will start Bash on the partially built container using interactive mode. You don’t need to run Bash, all applications present on the container can be run in this way as per this answer on StackOverflow.

I read the logs from the npm install command and remembered that I forgot to exclude the locally built Node modules with .dockerignore. Thus, modules built for debug mode on macOS was used in production mode on Debian. I updated .dockerignore:

**/obj/
**/bin/
**/node_modules/

And finally docker build -t hjerpbakk/react-app . completed successfully!

The container could the be run with:

docker run -p 80:80 hjerpbakk/react-app

Conclusion

ASP.Net, React and Docker are great tools to use together. However, they are also moving targets in constant motion. Thus at the time of writing, the following was needed to go from Hello World! locally to Hello World! running in a Docker container:

  1. Remove reference added by the template that is no longer needed.
  2. The container image needed more tools than the image from Microsoft provided.
  3. Never include locally built files in the build context used by the Dockerfile. .dockerignore truly is your friend!


Answers of
> Error MSB3073: The command “npm run build” exited with code 1

Perform any of the following options as long w3coded build prod as there is an error,For passing an argument to w3coded build prod build command:,For passing an argument to build w3coded build prod command:

change ‘npm run build — —prod’ to w3coded build prod ‘npm run build —prod’ in the .csproj file w3coded build prod ,change ‘npm run build — —prod’ to ‘npm run w3coded build prod build —prod’ in the .csproj file

Got same error, my environment:

.NET Core 2.1 RC-1
Angular v5.2.4
NPM v5.7.1
Node v8.11.2

And nothing mentioned above did not helped.
Simple go to «.ClientApp» //Angula-CLI project and run

npm run build

Check this maybe you have problem with lack of memory

 "build": "node --max-old-space-size=4069 node_modules/@angular/cli/bin/ng build --prod",

From the error in your output window, it seems that the npm build command is targeting the wrong directory and cannot find the package.json file to perform its build:

11 error code ENOENT
12 error errno -4058
13 error syscall open
14 error enoent ENOENT: **no such file or directory, open** 'C:ProjectJWSJWSApplicationpackage.json'
15 error enoent ENOENT: no such file or directory, open 
'C:ProjectJWSJWSApplicationpackage.json'
15 error enoent This is most likely not a problem with npm itself
15 error enoent and is related to npm not being able to find a file.
16 verbose exit [ -4058, true ]

If you open your .csproj file, you should see where the ClientApp/SpaRoot file is located. Ideally, it will be something like below:

<PropertyGroup>
        <SpaRoot>ClientApp</SpaRoot>
        <DefaultItemExcludes>$(DefaultItemExcludes);$(SpaRoot)node_modules**</DefaultItemExcludes>
</PropertyGroup>

Based on the above, the directory path to your ClientApp/SpaRoot folder will be configured which contains the package.json file and will be used when calling npm build during deployment:

<Target Name="PublishRunWebpack" AfterTargets="ComputeFilesToPublish">
        <!-- As part of publishing, ensure the JS resources are freshly built in production mode -->
        <Exec **WorkingDirectory="$(SpaRoot)"** Command="npm install" />
        <Exec **WorkingDirectory="$(SpaRoot)"** Command="npm run build --prod" />
        <Exec **WorkingDirectory="$(SpaRoot)"** Command="npm run build:ssr --prod" Condition=" '$(BuildServerSideRenderer)' == 'true' " />
        
        <!-- Include the newly-built files in the publish output -->
        <ItemGroup>
            <DistFiles Include="$(SpaRoot)dist**; $(SpaRoot)dist-server**" />
            <DistFiles Include="$(SpaRoot)node_modules**" Condition="'$(BuildServerSideRenderer)' == 'true'" />
            <ResolvedFileToPublish Include="@(DistFiles->'%(FullPath)')" Exclude="@(ResolvedFileToPublish)">
                <RelativePath>%(DistFiles.Identity)</RelativePath>
                <CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
                <ExcludeFromSingleFile>true</ExcludeFromSingleFile>
            </ResolvedFileToPublish>
        </ItemGroup>
    </Target>

Current topics : Error MSB3073: The command “npm run build” exited with code 1

Newly Added Questions

Понравилась статья? Поделить с друзьями:
  • Error msb3073 cmake
  • Error msb3030 could not copy the file
  • Error msb3027 не удалось скопировать
  • Error msb3021 не удалось скопировать файл
  • Error msb1003 укажите проект или файл решения