Unauthorized response from GitHub API on Appveyor - github

We just started with a new project and trying to get CI working via Appveyor.
It is an Aurelia web application so we need jspm on the build server.
On my workstation I configured jspm manually as suggested by #guybedford in his answer below and configured my authtoken in appveyor.yml script:
- jspm config registries.github.auth %JSPM_GITHUB_AUTH_TOKEN%
Currently my appveyor.yml looks like this, based on the Auto configuring section from JSPM
version: 1.0.{build}
os: Visual Studio 2015
build:
verbosity: detailed
environment:
JSPM_GITHUB_AUTH_TOKEN:#token from jspm registry export github (locally)#
install:
- ps: Set-Culture nl-NL
- ps: Install-Product node $env:nodejs_version
- cd src\Web
- npm uninstall jspm -g
- npm install -g jspm
- npm install -g gulp
- npm install
- jspm config registries.github.auth %JSPM_GITHUB_AUTH_TOKEN%
- jspm config registries.github.maxRepoSize 0
- jspm registry export github #output to see what the registry looks like
- jspm install -y
- gulp build
- cd ..\..
nuget:
account_feed: true
before_build:
- dnvm install -r clr -arch x86 1.0.0-rc1-update1
- dnu restore
- nuget restore
The jspm install - y command fails with the error: Unauthorized response for GitHub API.
How do I configure Github credentials properly with JSPM on AppVeyor?

It is best to take this token from jspm registry export github after configuring the credentials locally in order to use the exact same algorithm as jspm instead of doing a manual encoding.
If you really want manual encoding, the auth token actually takes the value of new Buffer(encodeURIComponent(username) + ':' + encodeURIComponent(password)).toString('base64').

After contact with the Appveyor team we figured oud that the node version was the problem.
Installing the stable version of Node works like a charm:
ps: Install-Product node stable

Related

npm notice Beginning October 4, 2021, all connections to the npm registry - including for package installation - must use TLS 1.2 or higher

I am getting this warning from github on my npm project build process...
I tried searching on the internet and also read the blog link posted by github - but I could not find the solution to it anywhere. Am I missing something ?
Warning seen
npm notice Beginning October 4, 2021, all connections to the npm registry - including for package installation - must use TLS 1.2 or higher. You are currently using plaintext http to connect. Please visit the GitHub blog for more information: https://github.blog/2021-08-23-npm-registry-deprecating-tls-1-0-tls-1-1/
After updating your NodeJS and NPM Version run this command in CLI
npm set registry=https://registry.npmjs.org/
Save your Life, Thanks me Later :D
I can solve the issue by the way:
First Step: npm set registry=https://registry.npmjs.org/
Second Step: npm install -g https://tls-test.npmjs.com/tls-test-1.0.0.tgz
Besides updating your version of node to an active or current LTS you want to ensure your NPM registry is set to an HTTPS endpoint:
registry=https://registry.npmjs.org/
You are facing that issue because your registry is set to HTTP version which is a bit insecure so the first thing that you should do is to put it to HTTPS version by running the following command below
npm set registry=https://registry.npmjs.org/
Then, after that you have to make sure your version of npm supports TLS 1.2, you can install a test package from an HTTPS endpoint that already has TLS 1.0 and TLS 1.1 disabled: by running this command below
npm install -g https://tls-test.npmjs.com/tls-test-1.0.0.tgz
You should see the following message:
Hello! The tls-test package was successfully downloaded and installed. Congratulations! Your package manager appears to support TLS 1.2.
If you don't see the message, don't worry you can try to install the package again, hope it will work out for you
Please make sure that you have latest(or somewhat recent) version of node installed on your system
To make sure that your version of npm supports TLS 1.2, you can install a test package from an HTTPS endpoint that already has TLS 1.0 and TLS 1.1 disabled:
npm install -g https://tls-test.npmjs.com/tls-test-1.0.0.tgz
You should see the following message:
Hello! The tls-test package was successfully downloaded and installed.
Congratulations! Your package manager appears to support TLS 1.2.
If you didn't see the above message, try to install some npm package.
If you didn't see the npm notice, you're good to go. If you happened to see again, please run the below command too.
npm set registry=https://registry.npmjs.org/
Source: The npm registry is deprecating TLS 1.0 and TLS 1.1
You are facing this issue because of your registry is still set to http version and that causing you this error. All You need to do is just Run following command in your terminal.
npm config set registry https://registry.npmjs.org/
and that is it!
now you can run any npm command
Well, I had several problems with node and npm. The one described in this question was only the last one.
I was not able to execute npm install, the node_modules were partially downloaded and at the end of the execution they were all deleted (the folder was visible, but it was deleted after running the command).
First problem: --location=global
First, I was getting this error message:
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead
Which I solved by following these instructions: https://stackoverflow.com/a/72592742/7389293
Apparently that allowed me to update to:
node -v: c16.16.0
npm -v: 8.17.0
Today's date: August 13, 2022.
Second problem: use TLS 1.2 or higher
Then, I still was having the error described in this question, which didn't allowed me to install the node_modules folder in my project:
npm notice Beginning October 4, 2021, all connections to the npm registry - including for package installation - must use TLS 1.2 or higher
The selected answer to the question made in the present screen your reading, finally fixed the problem: https://stackoverflow.com/a/70555822/7389293
After all of this I was able to run npm again, install all the packages from the package.json file, and run the website normally in the browser.
maxtimeout didn't work for me
so I tried converting to yarn by npm I -g yarn
and then yarn install in the root directory of the project(where I have to install the node_modules)

Set up CI with Travis for .NET Core

I'm trying to set up a CI for my .NET Core 3.1 class library. I created an account at https://travis-ci.org/github and selected my repository containing the code for my class library for a CI build.
Travis is successfully watching my master branch for commits, but I cannot get the CI build to succeed.
My repository: https://github.com/MintPlayer/MintPlayer.AspNetCore.SitemapXml
Target framework: .NET Core 3.1
My latest .travis.yml file:
language: csharp
mono: none
dotnet: 3.1.302
script:
- dotnet restore
dist: trusty
sudo: required
History of attempted travis.yml files (all failed):
But somehow this always errors, this time with the following output:
Clean output:
docker stop/waiting
resolvconf stop/waiting
C# support for Travis-CI is community maintained.
Please open any issues at https://travis-ci.community/c/languages/37-category and cc #joshua-anderson #akoeplinger #nterry
Installing .NET Core
$ export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
$ export DOTNET_CLI_TELEMETRY_OPTOUT=1
E: Unable to locate package dotnet-sdk-3.1
E: Couldn't find any package by glob 'dotnet-sdk-3.1'
E: Couldn't find any package by regex 'dotnet-sdk-3.1'
The command "sudo apt-get install -qq dotnet-sdk-3.1=3.1.302*" failed and exited with 100 during .
Your build has been stopped.
Raw output: https://api.travis-ci.org/v3/job/709293291/log.txt
What's wrong with my travis.yml configuration. Why can't I CI test my class library with this config?
I mainly want to CI test for .NET Core. If mono could be included this would be very nice. All the examples you'd find in the git history are also examples that I digged up in other repositories.
You are using:
dist: trusty
That's Ubuntu 14.04.6 LTS which is not supported by .NET Core 3.1. Try a newer version of Ubuntu such as bionic.
This is also answered in the travis community post:
dotnet-sdk-3.0 is not available for Trusty (presumably because it’s EOL): https://packages.microsoft.com/ubuntu/14.04/prod/dists/trusty/main/binary-amd64/Packages Move to dist: xenial (which is the default so you can just omit it) or dist: bionic.

Bitbucket Piplines: Upload from a sub directory to staging / production server

I am trying to upload my project using bitbucket's pipeline service and its working fine. However, I only need to upload the files from a specific sub-directory.
My directory structure is as follows:
Repository:
- Appz
- Android
- iOS
- Designs
- Appz
- Web
- Web
- Html
- Laravel
I need to upload the files form the Repository / Web only (not from any other directory). But the pipeline service is uploading the entire repository to server.
bitbucket-pipelines.yml
image: php:7.2
pipelines:
branches:
master:
- step:
script:
- apt-get update && apt-get install -y unzip git-ftp
- export PROJECT_NAME=Web/
- git-ftp init --user $FTP_USERNAME --passwd $FTP_PASSWORD ftp://domain/path
I found the solution. The only command which requires the modification is the git-ftp command. However, I also found that the export command doesn't have anything to do here, so I removed it and the command still worked as I require.
Here how it goes:
- apt-get update && apt-get install -y unzip git-ftp
- git-ftp init --syncroot Web --user $FTP_USERNAME --passwd $FTP_PASSWORD ftp://domain/path
The specified --syncroot <PATH/TO/DIRECTORY> parameter is all it takes to set the desired source location from where the pipeline service need to fetch and upload files.
I hope this helps.
Thank you.

ERROR:The serve command requires to be run in an Angular project, but a project definition could not be found

I am trying to clone the git repository for Tour of Heros with NgRX (blove/ngrx-tour-of-heros)
However, I can not seem to run the application.
I have updated my Angular cli to 7.3 I have installed yarn to try and help as well as tried to create a new application and remove files to drag and drop files that where not there like the node modules, and I am still getting this error.
How do I get this error removed so that I can see the file?
Check your build per-requisites, as illustrated by blove/ngrx-tour-of-heros issue 2
Breaking changes - node => 10
ERROR - "json-server requires at least version 4 of Node, please upgrade"
if your node -v is greater than 10, npm upgrade json-server
Appears that node-sass was optional on yarn install.
Had to install separately - yarn add none-sass
Also, cd client and cd server are reversed in lines 13 and 15.
The angular project is in de client directory, so after cloning the repo you have to get into the client directory before running the ng serve command:
git clone https://github.com/blove/ngrx-tour-of-heros.git
cd ./client
yarn install
npm run start
Seems like it's an older repo with Angular v5 and CLI v 1.6 - try downgrading if it doesn't work. https://github.com/blove/ngrx-tour-of-heros/blob/master/client/package.json#L32

Can you specify minor jdk version for travis ci

Is it possible to specify the minor version of the JDK for jobs running on Travis? I have a JavaFX project which is failing because JDK 1.8.0_31 is being used to perform the build where as the project uses some classes that were only shipped in Java 1.8.0_40 (specifically Alert and Spinner).
Currently my .travis.yml file looks like below:
language: java
jdk:
- oraclejdk8
Here's a link to the failed build just in case it's useful.
This solution based on apt addon works for me:
language: java
jdk:
- oraclejdk8
addons:
apt:
packages:
- oracle-java8-installer
In result I have java version "1.8.0_91". The solution source is here
I finally got it working. This solution is not really reccommended as it uses linuxbrew to install Oracle JDK 8.0_40. Thanks to zrcoder on Github I ended up with this .travis.yml:
language: java
branches:
only:
- master
notifications:
email: false
before_install:
- rm -rf ~/.linuxbrew
- yes | ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/linuxbrew/go/install)"
- export PATH="$HOME/.linuxbrew/bin:$PATH"
- export MANPATH="$HOME/.linuxbrew/share/man:$MANPATH"
- export INFOPATH="$HOME/.linuxbrew/share/info:$INFOPATH"
- brew install jdk
- export JAVA_HOME=/home/travis/.linuxbrew/Cellar/jdk/1.8.0-40
Although this works, Travis-CI should be updated by next month, so update your config for shorter build times.
I recommend using Travis CI's Trusty build environment which uses newer software than the default Precise environment. It's quicker and more reliable than redownloading the newest JDK on each build.
Just add the following to the top level of .travis.yml
dist: trusty