Yarn 2.0: unable to get local issuer certificate - yarnpkg

Attempting to migrate to yarn 2.0 and run into a problem with private npm packages resulting in
YN0001: │ GotError: unable to get local issuer certificate
Got around this in yarn 1.x with the strict-ssl: false config setting. Is there a way of doing something similar in the new .yarnrc.yml? Couldn't find anything related in the docs.
My .yarnrc.yml:
yarnPath: .yarn/releases/yarn-sources.js
npmScopes:
companyName:
npmRegistryServer: "https://www.myget.org/F/companyName/npm"

Related

Yarn add - Private package - 404 Not Found

I want to install a private package hosted on an internal Gitlab with Yarn.
So, I configured my .npmrc with this informations :
#mypackage:registry=https://gitlab.intra/api/v4/packages/npm/
//gitlab.intra/api/v4/projects/819/packages/npm/:_authToken=xxxxx
//gitlab.intra/api/v4/packages/npm/:_authToken=xxxxx
always-auth=true
When I attempt to install the package with yarn add #mypackage/lib-node-client, Yarn give me an error :
Trace:
Error: https://gitlab.intra/api/v4/projects/725/packages/npm/#mypackage/lib-node-common/-/#mypackage/lib-node-common-21.7.1.tgz: Request failed "404 Not Found"
at ResponseError.ExtendableBuiltin (/usr/lib/node_modules/yarn/lib/cli.js:696:66)
at new ResponseError (/usr/lib/node_modules/yarn/lib/cli.js:802:124)
at Request.<anonymous> (/usr/lib/node_modules/yarn/lib/cli.js:67062:16)
at Request.emit (node:events:369:20)
at Request.module.exports.Request.onRequestResponse (/usr/lib/node_modules/yarn/lib/cli.js:141640:10)
at ClientRequest.emit (node:events:369:20)
at HTTPParser.parserOnIncomingClient (node:_http_client:646:27)
at HTTPParser.parserOnHeadersComplete (node:_http_common:129:17)
at HTTPParser.execute (<anonymous>)
at TLSSocket.socketOnData (node:_http_client:512:22)
So, Yarn can't find the URL : https://gitlab.intra/api/v4/projects/725/packages/npm/#mypackage/lib-node-common/-/#mypackage/lib-node-common-21.7.1.tgz
If I try to get this on my browser, I can download the package...
If anyone can help me please, thank's for all :)
In your .npmrc file, you tell how to connect to GitLab for the project 819. The error is about the project 725. GitLab simply refuse the connexion.
Try with
#mypackage:registry=https://gitlab.intra/api/v4/packages/npm/
//gitlab.intra/api/v4/projects/725/packages/npm/:_authToken=xxxxx
//gitlab.intra/api/v4/projects/819/packages/npm/:_authToken=xxxxx
//gitlab.intra/api/v4/packages/npm/:_authToken=xxxxx
always-auth=true
We had a gitlab private package registry, and was constantly getting this error.
npm i #placeholder/package-name works fine, but yarn add #placeholder/package-name was giving 404 errors.
I tried all possible solutions listed on this thread. At last, there was a section in gitlab on troubleshooting yarn installation [1].
It said,
try adding this to your .npmrc file (and replace <your_token> with your personal access token or deploy token):
//gitlab.example.com/api/v4/projects/:_authToken=<your_token>
Our previous .npmrc looked like this
save-exact=true
unsafe-perm=true
#placeholder:registry=https://gitlab.com/api/v4/packages/npm/
//gitlab.com/api/v4/packages/npm/:_authToken=${PLACEHOLDER_TOKEN}
With the above new line addition, it looked like this,
save-exact=true
unsafe-perm=true
#placeholder:registry=https://gitlab.com/api/v4/packages/npm/
//gitlab.com/api/v4/packages/npm/:_authToken=${PLACEHOLDER_TOKEN}
//gitlab.com/api/v4/projects/:_authToken=${PLACEHOLDER_TOKEN}
With that addition, yarn add #placeholder/package-name worked fine.
[1] https://docs.gitlab.com/ee/user/packages/npm_registry/#error-running-yarn-with-the-package-registry-for-npm-registry
This should be the accepted answer. //gitlab.com/api/v4/projects/:_authToken=${PLACEHOLDER_TOKEN} Was the piece I was missing, which supercedes needing to list each project id as in Joel's answer.

Travis CI Deploy to AWS ElasticBeanstalk

Hi I currently try to deploy my react app to AWS Elastic Bean Stalk through travis CI. But it fail.. what should I change in my travis yml??
Here is my .travis.yml
sudo: required
services:
- docker
before_install:
- docker build -t sample:dev .
script:
- docker run -e CI=true sample:dev npm run test -- --coverage
deploy:
provider: elasticbeanstalk
region: "us-west-1"
app: "my-app"
env: "MyApp-env"
bucket_name: "xxxx"
bucket_path: "xxx"
on:
branch: master
access_key_id: $AWS_ACCESS_KEY
secret_access_key:
secure: "$AWS_SECRET_KEY"
But I failed to deploy it in aws elastic bean stalk. Here is the message from travis ci:
The command "docker run -e CI=true sample:dev npm run test -- --coverage" exited with 0.
dpl_0
1.27s$ rvm $(travis_internal_ruby) --fuzzy do ruby -S gem install dpl
dpl.1
Installing deploy dependencies
Successfully installed jmespath-1.4.0
Successfully installed aws-eventstream-1.0.3
Successfully installed aws-sigv4-1.1.1
NEWER VERSION AVAILABLE: Please upgrade to AWS SDK For Ruby V3
Successfully installed aws-sdk-core-2.11.471
NEWER VERSION AVAILABLE: Please upgrade to AWS SDK For Ruby V3
Successfully installed aws-sdk-resources-2.11.471
NEWER VERSION AVAILABLE: Please upgrade to AWS SDK For Ruby V3
Successfully installed aws-sdk-2.11.471
Successfully installed rubyzip-1.3.0
Successfully installed dpl-elastic_beanstalk-1.10.15
8 gems installed
!!! AWS Elastic Beanstalk support is experimental !!!
dpl.2
Preparing deploy
Cleaning up git repository with git stash --all. If you need build artifacts for deployment, set deploy.skip_cleanup: true. See https://docs.travis-ci.com/user/deployment#Uploading-Files-and-skip_cleanup.
No local changes to save
NEWER VERSION AVAILABLE: Please upgrade to AWS SDK For Ruby V3
dpl.3
Deploying application
No stash entries found.
/home/travis/.rvm/gems/ruby-2.4.5/gems/aws-sdk-core-2.11.471/lib/seahorse/client/plugins/raise_response_errors.rb:15:in call': The request signature we calculated does not match the signature you provided. Check your key and signing method. (Aws::S3::Errors::SignatureDoesNotMatch)
from /home/travis/.rvm/gems/ruby-2.4.5/gems/aws-sdk-core-2.11.471/lib/aws-sdk-core/plugins/s3_sse_cpk.rb:19:incall'
from /home/travis/.rvm/gems/ruby-2.4.5/gems/aws-sdk-core-2.11.471/lib/aws-sdk-core/plugins/s3_dualstack.rb:24:in call'
from /home/travis/.rvm/gems/ruby-2.4.5/gems/aws-sdk-core-2.11.471/lib/aws-sdk-core/plugins/s3_accelerate.rb:34:incall'
from /home/travis/.rvm/gems/ruby-2.4.5/gems/aws-sdk-core-2.11.471/lib/aws-sdk-core/plugins/jsonvalue_converter.rb:20:in call'
from /home/travis/.rvm/gems/ruby-2.4.5/gems/aws-sdk-core-2.11.471/lib/aws-sdk-core/plugins/idempotency_token.rb:18:incall'
from /home/travis/.rvm/gems/ruby-2.4.5/gems/aws-sdk-core-2.11.471/lib/aws-sdk-core/plugins/param_converter.rb:20:in call'
from /home/travis/.rvm/gems/ruby-2.4.5/gems/aws-sdk-core-2.11.471/lib/seahorse/client/plugins/response_target.rb:21:incall'
from /home/travis/.rvm/gems/ruby-2.4.5/gems/aws-sdk-core-2.11.471/lib/seahorse/client/request.rb:70:in send_request'
from /home/travis/.rvm/gems/ruby-2.4.5/gems/aws-sdk-core-2.11.471/lib/seahorse/client/base.rb:207:inblock (2 levels) in define_operation_methods'
from /home/travis/.rvm/gems/ruby-2.4.5/gems/aws-sdk-resources-2.11.471/lib/aws-sdk-resources/request.rb:24:in call'
from /home/travis/.rvm/gems/ruby-2.4.5/gems/aws-sdk-resources-2.11.471/lib/aws-sdk-resources/operations.rb:41:incall'
from /home/travis/.rvm/gems/ruby-2.4.5/gems/aws-sdk-resources-2.11.471/lib/aws-sdk-resources/operation_methods.rb:19:in block in add_operation'
from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-elastic_beanstalk-1.10.15/lib/dpl/provider/elastic_beanstalk.rb:131:inupload'
from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-elastic_beanstalk-1.10.15/lib/dpl/provider/elastic_beanstalk.rb:49:in push_app'
from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-1.10.15/lib/dpl/provider.rb:199:inblock in deploy'
from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-1.10.15/lib/dpl/cli.rb:41:in fold'
from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-1.10.15/lib/dpl/provider.rb:199:indeploy'
from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-1.10.15/lib/dpl/cli.rb:32:in run'
from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-1.10.15/lib/dpl/cli.rb:7:inrun'
from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-1.10.15/bin/dpl:5:in <top (required)>'
from /home/travis/.rvm/gems/ruby-2.4.5/bin/dpl:23:inload'
from /home/travis/.rvm/gems/ruby-2.4.5/bin/dpl:23:in `'
failed to deploy
Based on the new version of Travis CI, following lines code, you need to update
secret_access_key:
secure: "$AWS_SECRET_KEY"
Change it to :
secret_access_key: "$AWS_SECRET_KEY"
Alse need to add "skip_cleanup: true" under deploy:
Because Travis CI now consider default variable as secure.
Looking at the first error from your output:
call': The request signature we calculated does not match the signature you provided. Check your key and signing method. (Aws::S3::Errors::SignatureDoesNotMatch)
I got the same error and it was caused by a mismatch on the access_key_id and secret_access_key. I resolved it by running:
travis encrypt --add deploy.access_key_id <access_key_id>
travis encrypt --add deploy.secret_access_key <secret_access_key>

Cordova create project

I've got Apache Cordova (latest version as of today) installed on a Windows7 machine and am attempting to create a new project. I'm inside a firewall, so have set proxies (npm config set proxy ..., npm config set https-proxy ... ) to access internet.
using the following command:
cordova create testApp1
I get the following error output:
Creating a new cordova project with name "HelloCordova" and id "io.cordova.hellocordova" at location "C:\Users\sr7\Documents\Cordova\testApp1"
Downloading cordova library for www...
Error: tunneling socket could not be established, cause=Parse Error
at ClientRequest.onError (C:\Users\sr7\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\request\node_modules\tunnel-agent\index.js:168:17)
at ClientRequest.g (events.js:199:16)
at ClientRequest.emit (events.js:107:17)
at Socket.socketOnData (_http_client.js:315:9)
at Socket.emit (events.js:107:17)
at readableAddChunk (_stream_readable.js:163:16)
at Socket.Readable.push (_stream_readable.js:126:10)
at TCP.onread (net.js:529:20)
This would appear to be a proxy issue, however if I do this at home (i.e. no proxy), it still fails although the error is different, i.e.
Creating a new cordova project with name "HelloCordova" and id "io.cordova.hellocordova" at location "C:\Users\sr7\Documents\Cordova\testApp1"
Downloading cordova library for www...
Error: tunneling socket could not be established, cause=getaddrinfo ENOTFOUND wwwcache.sanger.ac.uk
at ClientRequest.onError (C:\Users\sr7\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\request\node_modules\tunnel-agent\index.js:168:17)
at ClientRequest.g (events.js:199:16)
at ClientRequest.emit (events.js:107:17)
at Socket.socketErrorListener (_http_client.js:272:9)
at Socket.emit (events.js:107:17)
at net.js:923:16
at process._tickCallback (node.js:355:11)
It appears to still be trying to find the proxy "wwwcache.sanger.ac.uk", although I've removed the proxy info from npm (they both show null if I do "npm config ls -l").
Can anyone suggest a way to fix this, ideally within a firewall. Thanks.
Being behind a proxy, I've encountered the same issue with latest version of nodejs.
To fix it, download latest version of tunnel-agent here
and put it in the npm folder of your installed cordova-lib :
.\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\npm\node_modules\request\node_modules\tunnel-agent
Source of information : https://issues.apache.org/jira/browse/CB-8662

gradlew.bat (and gradlew) SSLHandShakeException

I'm new to Gradle and was going through this Spring Tutorial found here:
http://spring.io/guides/gs/gradle/
I get to the part where it tells me to add this task:
task wrapper(type: Wrapper) {
gradleVersion = '2.3'
}
I run gradle wrapper which creates the gradlew and gradlew.bat files.
Trying to run both of this I get this exception:
Downloading https://services.gradle.org/distributions/gradle-2.3-bin.zip
Exception in thread "main" javax.net.ssl.SSLHandshakeException: sun.security.val
idator.ValidatorException: PKIX path building failed: sun.security.provider.cert
path.SunCertPathBuilderException: unable to find valid certification path to req
uested target
at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)
at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1884)
at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:276)
at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:270)
at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.
java:1341)
at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.jav
a:153)
at sun.security.ssl.Handshaker.processLoop(Handshaker.java:868)
at sun.security.ssl.Handshaker.process_record(Handshaker.java:804)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1016)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.
java:1312)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1339
)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1323
)
at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:
563)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect
(AbstractDelegateHttpsURLConnection.java:185)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLCon
nection.java:1300)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Http
sURLConnectionImpl.java:254)
at org.gradle.wrapper.Download.downloadInternal(Download.java:56)
at org.gradle.wrapper.Download.download(Download.java:42)
at org.gradle.wrapper.Install$1.call(Install.java:57)
at org.gradle.wrapper.Install$1.call(Install.java:44)
at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAcc
essManager.java:65)
at org.gradle.wrapper.Install.createDist(Install.java:44)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:126)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:56)
Caused by: sun.security.validator.ValidatorException: PKIX path building failed:
sun.security.provider.certpath.SunCertPathBuilderException: unable to find vali
d certification path to requested target
at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:385)
at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.jav
a:292)
at sun.security.validator.Validator.validate(Validator.java:260)
at sun.security.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.j
ava:326)
at sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerIm
pl.java:231)
at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustMan
agerImpl.java:126)
at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.
java:1323)
... 19 more
Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to
find valid certification path to requested target
at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCert
PathBuilder.java:196)
at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:268)
at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:380)
... 25 more
I try to hit the webserver at https://services.gradle.org/distributions/gradle-2.3-bin.zip and I'm not getting any sort of error. I'm I missing some sort of config? Any help would be appreciated. Thanks!
if you could not fix anyway. and if you are inside firewall.
then.
you may can not download https.
should fix that Edit gradle-wrapper.properties file.
vi [project]/gradle/wrapper/gradle-wrapper.properties
#distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-bin.zip
distributionUrl=http\://services.gradle.org/distributions/gradle-2.8-bin.zip
change from https to http...
http://blog.cjred.net/gradlew-bat-and-gradlew-sslhandshakeexception/
After I modified, it says: Server returned HTTP response code: 403 for URL: http://services.gradle.org/distributions/gradle-6.0.1-all.zip
I experienced the same problem, however my symptoms were that my Ubuntu machine couldn't resolve any SSL hosts unless I specifically added them to Java's certificate authority (cacert) file.
I stumbled upon this Debian bug, and found a fairly straight-forward resolution: remove ca-certificates-java and install it again:
sudo dpkg --purge --force-depends ca-certificates-java
sudo apt-get install ca-certificates-java
I did a ./gradlew clean for good measure, and everything sprung to life again.
It seems, that the certificates for the gradle site were messed up. Doing a gradlew clean should fix this. See this thread on the Gradle forum: http://discuss.gradle.org/t/urgent-ssl-apache-configuration-for-services-gradle-org-is-bad/8808/4
Steps:
Run gradlew -Djavax.net.debug=all tasks
Go through the debug logs, and see if you find anything out of the ordinary.
In my case, seeing something like Zscaler did the trick, as i know i have Zscaler on(which by the way rewrites the TLS traffic blablabla), and it was trying to find the valid certification path to requested target, which obviously it couldn't find.
2 Options:
Exit Zscaler
If exiting Zscaler is not an option, go to your browser, export Zscaler Root Certificate
If you are using Brave browser, here are the steps:
Settings > Privacy and security > Manage device certificates > Trusted Root Certification Authorities > Find Zscaler Root CA > Export
and import it in the JVM truststore gradle is using, something like:
keytool -import -trustcacerts -alias Zscaler -file "Zscaler Root CA.cer" -keystore "%JAVA_HOME%"\jre\lib\security\cacerts
IMPORTANT: Do a gradlew clean before retrying any command.
In my case the problem was caused by an obsolete (7 years old) version of Java. Even gradlew clean did fail. After a Java update it worked fine.
In my case I was on a company network and behind a proxy, which as I understand it rewrites the SSL certificates, making the Java installation not trust any of them.
To solve it I had to create a gradle.properties file in my home directory under .gradle (~/.gradle/gradle.properties) and add the following line:
org.gradle.jvmargs=-DsystemProp.https.proxyHost=<myProxyHost> -DsystemProp.https.proxyPort=<myProxyPort> -DsystemProp.https.proxyUser=<myProxyUsername> -DsystemProp.https.proxyPassword=<myProxyPassword>
That solution was based on this SO answer: Gradle use certificate authentication for repository
This is because, Gradle tries to find the installed package in your local machine.
If you have the installed location:
D:\apps\gradle-3.3
Follow these steps in eclipse:
New Project
Gradle Project
Enter project Name
Local Installation Directory
Click Finish.
You are good to go.
Create this profile in user home:
$ vi ~/.yarnrc
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
strict-ssl false

Deploy meteor/meteorite 0.8.3 to heroku

I just updated my app to meteor 0.8.3. Locally it runs without problems. But when I try to push it to heroku, I'll get the following error:
Building meteor bundle
simple-schema: updating npm dependencies -- string...
iron-router: updating npm dependencies -- connect...
lodash: updating npm dependencies -- lodash...
Errors prevented bundling:
While building the application:
error: no such package: 'accounts-ui-bootstrap-3'
error: no such package: 'accounts-entry'
While building package `iron-dynamic-template`:
error: no such package: 'blaze'
tar: /app/tmp/cache/bundle.tar.gz: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now
tar: Child returned status 2
tar: Exiting with failure status due to previous errors
! Push rejected, failed to compile Meteor app app
For deployment, I used the buildpack of oortcloud. This worked proper in the past. https://github.com/oortcloud/heroku-buildpack-meteorite
I'm most confused by the earlier log entries before the error happens. Here it says that Meteor 0.8.1.1 is being installed. A couple of lines after that it confirms that Meteor 0.8.3 has been installed. I'm pretty sure that this is the same issue like this. https://github.com/EventedMind/iron-dynamic-template/issues/2
Installing Meteor 0.8.1.1
* 'meteor' build tool (vers
* 'meteor' build tool (version 43b8566b9f)
* Package updates: accounts-base accounts-meteor-developer accounts-oauth
accounts-password accounts-ui accounts-ui-unstyled amplify appcache
application-configuration autoupdate browser-policy browser-policy-common
browser-policy-content check coffeescript coffeescript-test-helper ctl
ctl-helper deps ejson email facebook facts follower-livedata force-ssl github
google html-tools htmljs http jquery-waypoints js-analyze less livedata
localstorage logging meetup meteor meteor-developer minifiers minimongo
mongo-livedata oauth oauth-encryption oauth1 oauth2 observe-sequence
reactive-dict routepolicy session showdown spacebars spacebars-compiler
spacebars-tests spiderable srp star-translate stylus templating test-helpers
test-in-browser tinytest twitter ui underscore-tests webapp weibo
Meteor 0.8.3 has been installed in your home directory (~/.meteor).
Now you need to do one of the following:
(1) Add ~/.meteor to your path, or
(2) Run this command as root:
cp ~/.meteor/tools/latest/launch-meteor /usr/bin/meteor
Then to get started, take a look at 'meteor --help' or see the docs at
docs.meteor.com.
I also tried to create a new meteorite app to get rid of dangling dependencies. But without success!
What can I do? Is there a chance to debug the push/deploy on the heroku server?
The outdated file .meteor/release caused the problem:
git heroku push master fetches the files to deploy from the origin git repository. It doesn't care about local, unstaged files. Somehow the file .meteor/release has not been pushed to the origin repository. So during the installation routine at heroku the meteor version was 0.8.1.1 and not 0.8.3.
Solution to avoid this problem:
Check/Add the files .meteor/release and .meteor/packages to your origin git repo
Test only what's in your origin repo before you deploy it. Use git pull

Resources