Yarn ignores proxy settings - jenkins

I try to get a build job running using yarn and react-native on a windows 10 machine. The following commands are executed inside of jenkins to prepare the actual build of a native Windows app.
yarn config set proxy http://192.109.190.88:8080
yarn config set https-proxy http://192.109.190.88:8080
yarn add react-native
This leads to the following output although the proxy settings are correct (tried "http://192.109.190.88:8080/" as well):
yarn add v0.27.5
[1/4] Resolving packages...
warning There appears to be trouble with your network connection. Retrying...
warning There appears to be trouble with your network connection. Retrying...
warning There appears to be trouble with your network connection. Retrying...
warning There appears to be trouble with your network connection. Retrying...
Any ideas on why this happens are well appreciated.

yarn version 2 requires a different variable name:
yarn config set httpProxy http://...
yarn config set httpsProxy http://...

Just follow this Link
https://yarnpkg.com/lang/en/docs/cli/config/
and remove the https-proxy and it worked for me.

I had the same issue and solved by following steps:
Run the following terminal command
npm cache clean --force
set http_proxy=
set https_proxy=
yarn config delete proxy
npm config rm https-proxy
npm config rm proxy
Restart your terminal
yarn
yarn –network-timeout 100000
Restart your terminal
it worked for me.

Related

I tried to install Pupilfirst LMS

I tried to install Pupilfirst LMS, I had difficulty in step
Compile Rescript Code: yarn run re: build
Output: Usage Error: could't find a script named "re: build".
And I also have difficulty in step
Run Webpack Dev Server: yarn run wds
Output: Usage Error: could't find a script named "wds".
is there any solution?
https://docs.pupilfirst.com/developers/development_setup
There shouldn't be a space between re: and build: yarn run re:build.
Also, when running a yarn run script_name command, make sure that your current directory contains a package.json file where the script script_name is defined.
In case of pupilfirst this file is in the root: https://github.com/pupilfirst/pupilfirst/blob/e41ffb8a57f4c59f7927056af324b5c283fb0038/package.json

Command failed unable to get local issuer certificate

When I create a brand new create-react-app and run the command yarn add electron --dev I get the following error.
RequestError: unable to get local issuer certificate
at ClientRequest.<anonymous> (C:\my-stuff\create-react-test\node_modules\got\source\request-as-event-emitter.js:178:14)
at Object.onceWrapper (events.js:520:26)
at ClientRequest.emit (events.js:412:35)
at ClientRequest.origin.emit (C:\my-stuff\create-react-test\node_modules\#szmarczak\http-timer\source\index.js:37:11)
at TLSSocket.socketErrorListener (_http_client.js:475:9)
at TLSSocket.emit (events.js:400:28)
The same thing happens with npm and chocolatey and only with electron. This doesn't happen on other computers. I've completely uninstalled node and reinstalled it.
This happens after it finished downloading the module. It is making a ClientRequest to a location on my computer. I don't understand why.
I've searched the internet for days for a solution. I've found the cnpm solution and it does work, but I want my project to be restorable from the git repository using npm install or yarn. Right now it is not. I'd have to remove electron from my package.json, restore, add it back and call the cnpm command.
npm config set strict-ssl false <- This command does not help.
I've tried separately installing got and #szmarczak\http-timer. This did not help.
I know it's old question but if anyone is facing this issue try running yarn config set enableStrictSsl false

Explanation and best practise around yarn - warning Integrity check: System parameters don't match

When I was building and trying to run my docker image with a rubyonrails app, I was getting this error:
warning Integrity check: System parameters don't match
error Integrity check failed
error Found 1 errors.
I tried changing my Docker file with
RUN yarn install --check-files
But that didn't do anything.
I then just deleted the yarn.lock file and my container now runs.
I am guessing the issue is that rails was run locally on my laptop, and now it is trying to run the same yarn.lock file on another computer and the integrity check is failing? Is this correct?
What should my dockerfile be doing? Should I exclude the yarn.lock file from getting into my docker container in the first place?
First of all, you will need to remove the node_modules folder and run the yarn install again. In your command line, follow these instructions:
Remove node_modules folder by typing rm -rf node_modules
Run yarn install
Run rails webpacker:install
Restart your command-line editor.
Be careful about the NodeJS version in your machine. It must be the same as the version in which the rails project was initialized. You can use nvm to manage the Node version.
Add "config.webpacker.check_yarn_integrity = false" in "development.rb" will solve the problem
I would suggest not copying yarn.lock in the container. You can add yarn.lock in the .dockerignore which Docker will ignore the yarn.lock while building the image.
I had faced similar issues because, locally I run on macOS and containers are alpine-based, so we end up ignoring the yarn.lock

NPM browserstack alias installed by package.json for TestCafe not recognized

Installing 'testcafe-browser-provider-browserstack' by package.json causes Jenkins job not to recognize 'browserstack'
Tried removing from package.json and install from command line but dependencies cause npm install to error.
testcafe 1.1.4
testcafe-browser-provider-browserstack 1.8.0
npm install
node_modules/.bin/testcafe -e browserstack:safari auth-subscriber-access-myaccount.js
ERROR Unable to find the browser. "browserstack:safari" is not a browser alias or path to an executable file.
One way to debug the issue would be to run the test explicitly with your BrowserStack credentials with the following command -
BROWSERSTACK_USERNAME="YOUR_USERNAME" BROWSERSTACK_ACCESS_KEY="YOUR_KEY" testcafe "browserstack:safari#12.0:OS X Mojave" "path/to/test/file.js"
I tried different paths and also moving to devDependencies in package.json but wasn't successful. I removed from package.json and installed command line at run time and it works.
Maybe I didn't find the right path to call it or it needs to be "local" installed but it now recognizes 'browserstack' this way.

Deploying a Rails / Ember app on AWS Elastic Beanstalk

I am having issues deploying my elastic beanstalk rails 4 + ember cli app. I have a rails application and within the root I have a folder called 'frontend' which contains my ember app generated by ember CLI Rails.
My configuration:
64bit Amazon Linux 2015.03 v1.3.1 running Ruby 2.1 (Puma)
I encounter the following error from my activity log after I run eb deploy:
At cursory, I get this
ERROR: Instance: i-25c139e7 Module: AWSEBAutoScalingGroup ConfigSet: null Command failed on instance. Return code: 1 Output: (TRUNCATED)...mber-cli-rails.rb:58:in `compile!'
Looking into /var/log/eb-activity.log
I first get a lot of
npm ERR! Error: Attempt to unlock X, which hasn't been locked
followed by
npm ERR! System Linux 3.14.35-28.38.amzn1.x86_64
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install"
npm ERR! cwd /var/app/ondeck/frontend
npm ERR! node -v v0.10.35
npm ERR! npm -v 1.4.28
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /var/app/ondeck/frontend/npm-debug.log
npm ERR! not ok code 0
rake aborted!
EmberCLI Rails requires your Ember app to have an addon.
From within your EmberCLI directory please run:
$ npm install --save-dev ember-cli-rails-addon#0.0.11
in you Ember application root: /var/app/ondeck/frontend
Tasks: TOP => assets:precompile => ember:compile
(See full trace by running task with --trace) (Executor::NonZeroExitStatus)
So I ssh into the directory indicated and run npm install, which also leaves me with a lot of errors regarding authorization. When I run with via sudo, the modules install correctly, but when I redeploy my app, it gives me the exact same error.
I have tried sudo NPM install and chown -R node_modules webapp so that the node_modules folder can be accessed by the webapp group with no success.
I hate long answers, but this scenario is quite complicated.
As mentioned in the comments above, it was discovered that the home directory for the webapp user needed to be created (/home/webapp). Once this directory is created, the node package manager (npm) can execute without error. Because AWSEB environments can scale, SSH'ing into the EB host and performing one-off installations of packages and modules will not work in the long run. Essentially the answer boils down to the following logical steps:
Install git on the application server because bower needs it.
Create the home directory of the webapp user at /home/webapp.
Install bower globally using npm.
Invoke the npm install of your ember app.
Invoke bower install for your ember app.
To fix this I went ahead and created several .ebextensions customization files that are executed during an eb deploy. Here they are in order:
.ebextensions/00_option_settings.config - sets some EB options; for example the timeout length for command executions performed during an eb deploy. In this case all commands will timeout after 1200 seconds.
option_settings:
- namespace: 'aws:elasticbeanstalk:command'
option_name: 'Timeout'
value: '1200'
.ebextensions/01_packages.config - can install packages through yum and make them available to your eb instance. In this case I use yum to install git, this will later be used by bower.
packages:
yum:
git: []
.ebextensions/02_commands.config - allows you to run OS commands prior to unpacking the application that was uploaded through eb deploy. This part of the answer satisfies the main theme of this question: In my particular case, I need to create the /home/webapp directory, make sure it is owned by the webapp user, and also has 700 permissions. Lastly, I ensure that bower is installed globally as it will be needed by my ember application.
commands:
01_mkdir_webapp_dir:
# use the test directive to create the directory
# if the mkdir command fails the rest of this directive is ignored
test: 'mkdir /home/webapp'
command: 'ls -la /home/webapp'
02_chown_webapp_dir:
command: 'chown webapp:webapp /home/webapp'
03_chmod_webapp_dir:
command: 'chmod 700 /home/webapp'
04_install_bower_global:
command: 'npm install -g bower'
.ebextensions/03_container_commands.config - runs OS command after the application has been unpacked. NOTE: My ember app lives in the frontend directory of application source code. In order to install the npm and bower dependencies, the npm install and bower install commands need to be executed from the frontend directory. It is also worth mentioning that the bower-install command needs the --allow-root flag in order to succeed as the AWS user executing these commands has elevated privileges.
container_commands:
01_npm_install:
# set the current working directory to fully-qualified frontend
cwd: '/var/app/ondeck/frontend/'
command: 'npm install'
leader_only: 'false'
02_bower_install:
# set the current working directory to fully-qualified frontend
cwd: '/var/app/ondeck/frontend/'
command: 'bower --allow-root install'
leader_only: 'false'
03_seeddb:
# seed my database (has nothing to do with this answer)
command: 'rake db:seed_fu'
leader_only: 'true'

Resources