Google Cloud Platform Visual Studio Publish - c#

I have been deploying my C# MVC application for years now, as early as yesterday, successfully. Today however I started getting this error:
Step 6/6 : RUN npm install firebase-admin
---> Running in 6af72a3f9eaf
[91m/bin/sh: 1: npm: not found
The command '/bin/sh -c npm install firebase-admin' returned a non-zero code: 127
ERROR
ERROR: build step 0 "gcr.io/cloud-builders/docker" failed: step exited with non-zero status: 127
[0m
--------------------------------------------------------------------------------
ERROR: (gcloud.app.deploy) Cloud build failed. Check logs at https://console.cloud.google.com/cloud-build/builds/ea90f766-e252-4b9b-b707-746acf8ad686?project=186443889098 Failure status: UNKNOWN: Error Response: [2] Build failed; check build logs for details
Failed to deploy project [Project Name] to App Engine Flex.
The logs say this:
Step 6/6 : RUN npm install firebase-admin
---> Running in 6af72a3f9eaf
/bin/sh: 1: npm: not found
The command '/bin/sh -c npm install firebase-admin' returned a non-zero code: 127
ERROR
ERROR: build step 0 "gcr.io/cloud-builders/docker" failed: step exited with non-zero status: 127
Has anyone seen this error or know whats casing it?

The problem was the node.js version was wrong. It was trying to use the wrong node version when publishing vs what was defined in the code.

Related

Test fails in net6.0 with no info

So i started writing xunit test in net 6.0 with visual studio 2022 community preview.
Everything was working fine on the first PC.
But then when i set the dev environment on another PC (both windows 10) and i try running tests i get this :
========== Starting test run ==========
Testhost process exited with error: . Please check the diagnostic logs for more information.
Testhost process exited with error: . Please check the diagnostic logs for more information.
========== Test run aborted: 0 Tests (0 Passed, 0 Failed, 0 Skipped) run in < 1 ms ==========
With no more information. Where can i find those "diagnostic logs" i don't find info about it on the web.
I tried running tests manually in command terminal with "dotnet test" but i get this :
**dotnet test
Determining projects to restore...
All projects are up-to-date for restore.
kis-project-information-core -> D:\Users\Thomas MEDARD\Documents\Apollo\Kis\Booth\Libraries\kis-project-information\sources\binaries\net6.0\kis-project-information-core.dll
kis-project-information-unit-tests -> D:\Users\Thomas MEDARD\Documents\Apollo\Kis\Booth\Libraries\kis-project-information\sources\binaries\net6.0\kis-project-information-unit-tests.dll
Test run for D:\Users\Thomas MEDARD\Documents\Apollo\Kis\Booth\Libraries\kis-project-information\sources\binaries\net6.0\kis-project-information-unit-tests.dll (.NETCoreApp,Version=v6.0)
Microsoft (R) Test Execution Command Line Tool Version 17.0.0
Copyright (c) Microsoft Corporation. All rights reserved.
Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
Testhost process exited with error: . Please check the diagnostic logs for more information.
Test Run Aborted.**
I ran dotnet test -verbosity:diagnostic --diag:log.txt to see details and here is what i get
log.txt
log.host.21-11-30_10-19-44_26197_5.txt
So i see my test is detected but something is going wrong when running it
Ok so i found what is happening.
After reinstalling i thought everything worked but actually i found the same problem again.
What i realized is that i was in admin mode on my terminal. When i run the same command from non admin terminal, i get the problem explained.
So my problem is accessing to dotnet. I guess it has something to do with having my source code stored in a different drive from dotnet.
It's still weird that i can build without problem but testing need elevated privileges.

The NPM script 'start' exited without indicating that the create-react-app server was listening for requests

I faced with this problem:
The NPM script 'start' exited without indicating that the create-react-app server was listening for requests. The error output was: 'rimraf' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! CallerPanelProject#0.1.0 start: `rimraf ./build && react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the CallerPanelProject#0.1.0 start 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:
))
TSystem.Threading.Tasks.Task<TResult>.GetResultCore(bool waitCompletionNotification)
I had this problem when made the Node SPA app inside ASP .NET Core and tried to perform start node app in the Production mode. In Development mode everything was OK.
This line in Stratup.cs file caused the problem:
spa.UseReactDevelopmentServer(npmScript: "start");
a source of the problem is: in the production mode Node app has been bundled already, i.e. it has no package.json and other Node related files, so start request is not possible to do.
A good way to fix that is to put start in to the clause:
if (env.IsDevelopment())
{
spa.UseReactDevelopmentServer(npmScript: "start");
}
You might have missed installing the dependencies in your source project. That is why it is unable to start to run your application without references.
Run npm install in your source project would resolve the issue
I ran into this problem, after starting afresh with Visual Studio 2019 after a longer break from it (so prette clean setup). It happened when I just tried to set up the simplest ASP.NET Core app, these are the steps I followed / roughly:
Check logs in "Event Viewer" for your app - there I found
"Could not find 'aspnetcorev2_inprocess.dll'. Exception message:
It was not possible to find any compatible framework version
The framework 'Microsoft.AspNetCore.App', version '2.2.0' was not found."
Went into Visual Studio Installer (Visual Studio | Tools | Get Tools and Features).
Select the "Individual Components" tab.
Check all (applicable) modules under .NET for ".NET Core .."-anything (I took them all).
Hit "Install while loading"
Restart Visual Studio.
Voila: ASP.NET core app started without errors.
I solved my problem by running "npm install rimraf" in the project folder.
A similar error as #JamesPoulose but I had installed npm. The problem was I installed it when Visual Studio was open. Event Viewer therefore showed me this error:
Category: Microsoft.AspNetCore.SpaServices
EventId: 0
'npm' is not recognized as an internal or external command,
A simple restart of Visual Studio fixed it.
In my case, it was a very silly problem. After re-installing my Windows, I missed installing npm altogether and then running npm install.
My colleague, Dave Wilson, fixed this for me. Went to our react project folder and deleted the node_modules. Next went to the command prompt and npm i in the project folder. Checked the output of npm i and saw that Python was not installed when the module fibres has a dependency on it. Installed python and added it to PATH in system variables. The key thing is to check the output of npm i.
I ran into this issue when Selecting HTTPS instead of HTTP. When running it on your localhost. Inside your visual studio project: Properties/launchSettings.json, change "applicationULR" to route to http instead of https(see image)
settings change

Docker with dotnet restore causes error: GSSAPI operation failed - An unsupported mechanism was requested

Having an ASP.NET Core 2.2 web application, I try to restore NuGet packages behind a coperate proxy
FROM mcr.microsoft.com/dotnet/core/sdk:2.2 AS sdk-image
WORKDIR /app/
ARG HTTP_PROXY
ENV HTTP_PROXY ${HTTP_PROXY}
ENV HTTPS_PROXY ${HTTP_PROXY}
COPY MyProject.csproj .
RUN dotnet restore
with the following docker-compose.yml:
version: '2'
services:
tool:
build:
context: .
args:
http_proxy: ${HTTP_PROXY}
networks:
default:
ipam:
driver: default
config:
- subnet: 192.168.239.0/21
The network got overriden because Dockers default network conflicts with internal company ranges. HTTP_PROXY is set on the host to a full url like http://user:password#proxy.internal:81.
When running docker-compose up --build it fails on restore:
Step 7/15 : RUN dotnet restore
---> Running in 62c8bb6f2f72
/usr/share/dotnet/sdk/2.2.402/NuGet.targets(123,5): error : Unable to load the service index for source https://api.nuget.org/v3/index.json. [/app/MyProject.csproj]
/usr/share/dotnet/sdk/2.2.402/NuGet.targets(123,5): error : GSSAPI operation failed with error - An unsupported mechanism was requested (Unknown error). [/app/MyProject.csproj]
ERROR: Service 'tool' failed to build: The command '/bin/sh -c dotnet restore' returned a non-zero code: 1
I could not find much information about this issue. A Github issue got this through their local TFS. But I don't have any self hosted repository, just the corporate proxy between me and NuGets server.
Seems like this is caused when the proxy requires NTLM, but the corresponding library is missing. I had this problem behind a corporate proxy and fixed it by installing the gss-ntlmssp package like this in Docker:
RUN apt-get install -y gss-ntlmssp
After installing those package, the authentication to the proxy for fetching NuGet packages works well.

Simple WebApi Stateless Service on a local ServiceFabric cluster fails to deploy

I'm trying to host WebAPI service on local ServiceFabric cluster. However, I'm unable to start even a simple Web Api template provided by VS2017.
I did the following:
I prepared the environment: https://learn.microsoft.com/en-us/azure/service-fabric/service-fabric-get-started
I created a new project in Visual Studio, choosing "Service Fabric Application", and "Stateless Web API" service template
When I build it, and click run, it tries to deploy it but I get the following error:
Screen1
And the output is:
2>Copying application to image store... 2>Copy application
package succeeded 2>Registering application type...
2>Register-ServiceFabricApplicationType : Operation timed out.
2>At C:\Program Files\Microsoft SDKs\Service
Fabric\Tools\PSModule\ServiceFabricS
2>DK\Publish-NewServiceFabricApplication.ps1:251 char:9 2>+
Register-ServiceFabricApplicationType -ApplicationPathInImage ...
2>+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2>
+ CategoryInfo : OperationTimeout: (Microsoft.Servi...usterConnection:ClusterConnection)
[Register-ServiceFabricApplicationType], TimeoutException 2> +
FullyQualifiedErrorId :
RegisterApplicationTypeErrorId,Microsoft.Service 2>
Fabric.Powershell.RegisterApplicationType 2>Finished executing
script 'Deploy-FabricApplication.ps1'. 2>Time elapsed:
00:02:01.7559509 2>The PowerShell script failed to execute.
========== Build: 1 succeeded, 0 failed, 1 up-to-date, 0 skipped ==========
========== Deploy: 0 succeeded, 1 failed, 0 skipped ==========
The interesting part is that when I choose basic "Stateless Service" template in Visual Studio, it works just fine. The problem I have is related to Web Api service on SF. My assumption is that the Web Api project has to write some additional info somewhere on the disk but does not have access to that path.
I tried reinstalling SF and SF SDK but with no results. I'm running VS2017 as an Administrator.
Any help greatly appreciated.

I just receive errors when trying to build mobile

I am new in the development in Android and i am having some problems in my learning. I am trying to build my solution in my cellphone, he is a Android of version 6.0. I fetched for some tutorials in the internet and even here in the Stack Overflow and because of it a downloaded all the versions of android sdk, since the 5.0 until the 7.1.1 and even the extra packages. Even so i continue receiving the same errors when i try to build my solution. They follow below:
FAILURE: Build failed with an exception.
Where: LuppApp
Build file 'C:\Oxaguia spk\Trabalhos\Coach IT\Visual Studio\LuppICS\SolutionLupp\LuppApp\platforms\android\build.gradle' line: 289
What went wrong: LuppApp 1
A problem occurred evaluating root project 'android'. LuppApp 1
Keystore file does not exist: c:\lupp-Release.keystore LuppApp 1
Try: LuppApp 1
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. LuppApp 1
Error: cmd: Command failed with exit code 1 Error output: LuppApp 1
FAILURE: Build failed with an exception. LuppApp 1
Where: LuppApp 1
Build file 'C:\Oxaguia spk\Trabalhos\Coach IT\Visual Studio\LuppICS\SolutionLupp\LuppApp\platforms\android\build.gradle' line: 289 LuppApp 1
What went wrong: LuppApp 1
A problem occurred evaluating root project 'android'. LuppApp 1
Keystore file does not exist: c:\lupp-Release.keystore LuppApp 1
Try: LuppApp 1
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. LuppApp 1
Picked up _JAVA_OPTIONS: -Xmx512M LuppApp 1
I will be really grateful for everyone who can help me. Thank you.
from the logs, what I see is that, you are trying to build app in release mode, Just check if you have the release-keystore file. Probably you can changed the built mode to debug since you are learning the app development.

Categories

Resources