BrowserSync certificate CLI - ssl

I'm using trying to get Browser-sync to work for our development environment. We use SSL/https
I have pasted the recommended snippet into my html file:
<script id="__bs_script__">//<![CDATA[
document.write("<script async src='https://HOST:3000/browser-sync/browser-sync-client.js?v=2.26.7'><\/script>".replace("HOST", location.hostname));
//]]></script>
And I use the following CLI command: npx browser-sync start --https --files "src/**/*"
Unfortunately the browser-sync script is blocked in Chrome (NET::ERR_CERT_AUTHORITY_INVALID) because of an invalid certificate when trying to get it from: https://localhost:3000/browser-sync/browser-sync-client.js?v=2.26.7
My application is hosted on https://localhost:5001, which has a valid certificate.
We don't use Gulp/Grunt, so I would prefer to solve this without having to use those.
I can't use the browser-sync --proxy option, because I need to launch Chrome with the "--remote-debugging-port" option.

I solved it by using chrome://flags/#allow-insecure-localhost

Related

Expo Error starting tunnel Failed to install #expo/ngrok#^2.4.3 globally

I'm trying to run expo with a tunnel connection and I keep getting the following error:
Error starting tunnel Failed to install #expo/ngrok#^2.4.3 globally: npm exited with non-zero code: 243
I've tried installing this version of ngrok globally and just within my project as well as removing it to allow expo to do the install automatically. It did run successfully once by starting the project with expo start instead of npm start but this seems to no longer work.
run npm install #expo/ngrok#2.4.3
Install ngrok and run it in terminal using this command ngrok http 3000.
Then in other terminal run expo start.
It will work surely.
The instructions are not intuitive, so here is a fix:
npm install #expo/ngrok
brew install ngrok
ngrok http 3000
expo start --tunnel
Wish Expo simplifies this; they shouldn't have a button that says "tunnel" if there is an entire setup that's not properly explained.

while installing cypress through command :npm install cypress --save-dev getting error as The Cypress App could not be downloaded

while installing cypress through command :npm install cypress --save-dev getting error as The Cypress App could not be downloaded.
Error :
Finishing Installation
The Cypress App could not be downloaded.
Does your workplace require a proxy to be used to access the Internet? If so, you must configure the HTTP_PROXY environment variable before downloading Cypress. Read more: https://on.cypress.io/proxy-configuration
Otherwise, please check network connectivity and try again:
But please not I m not using any proxy and on my personal wifi.
plz suggest ,what can be done in this case.Thanks
It seems to be too many possible reasons for this issue in general but I managed to find a workaround to install Cypress from within a corporation with npm and without using sudo npm or turning off strict ssl.
The following worked for me per November 18th 2020 with Ubuntu 18.04 and npm 6.14.8:
I downloaded the zip file shown in https://docs.cypress.io/guides/getting-started/installing-cypress.html#Direct-download
I installed cypress as shown in https://docs.cypress.io/guides/getting-started/installing-cypress.html#Install-binary : CYPRESS_INSTALL_BINARY=~/Downloads/cypress.zip npm install cypress --save-dev
I could now run npx cypress open to start the gui (which will also generate the cypress.json file)
Possible Reasons for this issue:
U might be running the project with a proxy setting.
One of the reason could be you are behind the firewall.that may prohibit your network? Please follow the guidelines in Proxy Configuration if so(https://docs.cypress.io/guides/references/proxy-configuration.html#Set-a-proxy-on-Linux-or-macOS).
make sure you have right access to install the cypress.
if none of the above mentioned reasons try removing the biraries or node_modules and install again.

vue-cli · Failed to download repo vuejs-templates/webpack-simple: tunneling socket could not be established, statusCode=403

I just started with Vue today and got stuck.
Following is the summary:
npm install -g vue-cli [Result - Successful]
vue init webpack-simple C:\vue [Result - Unsuccessful]
vue init webpack-simple ./ [Result - Unsuccessful]
Throws following error:
vue-cli · Failed to download repo vuejs-templates/webpack-simple: tunneling socket could
not be established, statusCode=403
Then tried the following commands:
npm config set http-profix null
vue init webpack-simple ./
It still throws the error.
Any pointers to this. I am running the script behind proxy wall.
Thanks.
The issue, I suspect is that you're installing from behind a VPN.
You can try disabling it to do the install
on corporate networks that's not always the option
If you don't have the option to disable...
you may be able to use
npm config set registry=http://registry.npmjs.org/
The reason that works is that you're no longer connecting to the default which uses https, where the SSL is failing due the the proxy.
Note that there is an issue of security if you opt to use http instead of https
You may also be able to use a proxy definition in a .npmrc file
If you have your proxy information, you can add it to the .npmrc file in the directory.
https://docs.npmjs.com/misc/config#https-proxy
proxy http://{proxy_server}:{proxy_port}
https-proxy http://{proxy_server}:{proxy_port}
strict-ssl=false
src gist

NPM install Error: self signed certificate in certificate chain

At my company, there is an auto signed ssl certificate. So they're some npm packages that cannot be installed because of it.
I already add strict-ssl=false in .npmrc or --strict-ssl=false command args.
It works for some packages but some doesn't seems to take in charge this option.
For exemple, I tried to install Cypress :
Command :
npm i cypress --save-dev --strict-ssl=false
Error logs :
> cypress#3.4.0 postinstall /Users/mchoraine/Documents/Workplace/SAMSE/rechercheproduit/rechercheproduit-front/node_modules/cypress
> node index.js --exec install
Installing Cypress (version: 3.4.0)
✖ Downloading Cypress
→ Cypress Version: 3.4.0
Unzipping Cypress
Finishing Installation
The Cypress App could not be downloaded.
Please check network connectivity and try again:
----------
URL: https://download.cypress.io/desktop/3.4.0?platform=darwin&arch=x64
Error: self signed certificate in certificate chain
----------
Platform: darwin (18.6.0)
Cypress Version: 3.4.0
Problem seems to occur only for packages with postinstall
The smartest things would be to change the SSL certificate but unfortunately it can't be done.
So are you aware of an alternative to bypass certificat verification on npm postinstall ?
Thanks in advance for your proposal.
Get a copy of your company's certificate, then set the NODE_EXTRA_CA_CERTS environmental variable to point to it before you run the npm commnand:
export NODE_EXTRA_CA_CERTS=path/to/certificate.crt
The post-install script is a separate node program, so the npm flag doesn't affect it.
Credit goes to "zerdos" who posted this solution on a related GitHub issue: https://github.com/cypress-io/cypress/issues/1401#issuecomment-393591520
For me the following solution worked.
OS - windows 10
Terminal - git bash
Run these commands before installing cypress.
setx HTTP_PROXY <your company proxy url>
setx NODE_EXTRA_CA_CERTS <path to cerm.pem file>
These will be set as environment variables in your system for any future use.
You can always get rid of them anytime if you do not need them.

how to get CSP version of vue2.x

from vuejs.org installation, runtime-only build is fully CSP-compliant.
after git clone , npm run build i got the vue.runtime.js version.
but it doesn't work in chrome extenstion enviroment.
so, could you just give me a csp version of vue2.x(vue.csp.js), like vue1.x ?