manually install npm packages? - selenium

I'm experimenting with protractor and following tuturial on github. NPM was already present on my system, I succesfully downloaded protractor and now I'm proceeding with
webdriver-manager update
Which fails with
downloading http://selenium-release.storage.googleapis.com/2.42/selenium-server-standalone-2.42.2.jar...
Error: Got error Error: getaddrinfo ENOTFOUND from http://selenium-release.storage.googleapis.com/2.42/selenium-server-standalone-2.42.2.jar
Updating chromedriver
Error: Got error Error: getaddrinfo ENOTFOUND from https://chromedriver.storage.googleapis.com/2.10/chromedriver_win32.zip
downloading https://chromedriver.storage.googleapis.com/2.10/chromedriver_win32.zip...
Per earlier answered equal questions I double checked my npm proxy settings, all fine for http and https. Also I can see the username:password#proxy definition in .npmrc in my userprofile directory (c:/Users/my-name), the files are also present on the internet. Also the npm install action of protractor worked well. Now is it possible to manually (via browser download the relevant files and have them exploded and installed in the designated places?
I'm on windows 7 SP 1, 32 bit.

Yes you can manually install the webdriver-manager file in "node_modules\protractor\bin".
By the way , the error message really looks like you have a trouble to access internet.
Did you try to set these variables before launching your npm command:
set HTTP_PROXY=http://'your http proxy ip':'your proxy port'
set HTTPS_PROXY=http://'your https proxy ip':'your proxy port'

To answer my own question:
As Yannick mentioned: I only set the proxy configuration with npm config ... For this you also need to set the environment variables
set PROXY=http://<username>:<password>#proxyserver
set HTTP_PROXY=%PROXY%
set HTTPS_PROXY=%PROXY%

Related

I can’t show the version of an NPM package (nodemon --version), what to do?

I tried to run codes in my hyper-terminal (deleted nodemon and then reinstalled it) but at the end I still can NOT get the version of my nodemon, it says:
"C:\Users\azadk\AppData\Roaming\npm/node_modules/node/bin/node: line 1: This: command not found"
Here’s what I tried to do:
I also tried to set the path of Environment variables to "C:\Program Files\nodejs" but still I can’t get the version.
If you are connected to some sort of VPN or your corporate internet, try to connect to another network and run the call again.
I entered these commands and the problem was resolved:
npm config rm proxy
npm config rm https-proxy
npm config delete http-proxy
npm config delete https-proxy
set HTTP_PROXY=null
set HTTPS_PROXY=null

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.

Error 403 - Forbidden while trying npm install

So just like every day I do different projects and install additional modules, today I want to install another module and such an error, reinstall the server and still the same .... [Error]The error appeared overnight
I found the issue from here: https://github.com/npm/npm/issues/2119#issuecomment-5321857
It's a very common issue in npm. Actually npm is not working good with HTTPS over a proxy. Changing the registry URL from HTTPS to HTTP will fix the problem.
Try this out:
npm config set registry http://registry.npmjs.org

ERROr: **npm ERR! Unexpected token < in JSON at position 0 while parsing near '<!DOCTYPE HTML PUBLI...'**

Image I am cloning the sitecore Habitat project to my local machine.
After cloning while running npm install, I am getting this error. I tired in all possible ways from the stack overflow answers, but did not succeed with answers still its showing errors, if anyone known about this please let me know.
ERROr: **npm ERR! Unexpected token < in JSON at position 0 while parsing near '<!DOCTYPE HTML PUBLI...'**
Just delete
package-lock.json file
It works for me.
I getting error like:
I found this solution in another question and worked for me after I set the registry like this:
npm set registry https://registry.npmjs.org/
Setting npm Registery worked for me
npm set registry https://registry.npmjs.org/
This error means there is a proxy in the middle which is denying you access to the Internet.
The error comes from the HTML page that is rendered from the proxy.
You need to check with your network administration to either allow the connection through (an exception), or you have to configure the variable HTTP_PROXY in your environment, which is like this:
http://username:password#proxy.server.com:port
Having tested npm install in several repos with the same error I ran npm cache clean --force and tried again. This is not as severe a solution as deleting all traces of node and reinstalling from the ground up.
I use an npm registry hosted at work for internal npm packages so couldn't change the registry source.
yes , its happned due to proxy setting, if this problem occurs, please check your proxy setting, in my case npm was getting blocked, You need to check with your network administration to either allow the connection through (an exception), or you have to configure the variable HTTP_PROXY in your environment
You need to check all required npm config setup like:
https-proxy=https://username:password#accessdomain:port/
proxy=http://username:password#accessdomain:port
registry=https://registry.npmjs.org/
//If required also add
msbuild_path=C:\Program Files\Microsoft Visual Studio\2022\Community\Msbuild\Current\Bin\MSBuild.exe
I was getting the same issue. I had un-installed NodeJs and deleted folders npm and npm-cache from Users\username\Appdata\Roaming folder and installed it.
Then set config registry by using command terminal as.
npm config set registry https://registry.npmjs.org/
To give an actual description of the problem and solution:
This happens when the URL set as your npm registry is incorrect (or as others have mentioned, a proxy has got in the way). Either way, you end up trying to download a package from an endpoint displaying HTML, which npm fails to parse as JSON (as one would expect).
You can view the URL for your npm config with
npm config get registry, and set it with npm config set registry https://my.registry.com/ (or https://registry.npmjs.org/ for the public registry)
I tried everything mentioned here. Nothing worked. Then I moved jsonwebtoken dependency to the bottom of package.json ( Below my registy specific dependencies ).
Then it worked!
Spent 6 hours in fixing this. I feel so small now.

Errors setting npm proxy config

I tried various npm config but all failed:
registry=http://registry.npmjs.org/
proxy=http://host:8080/
https-proxy=http://host:8080/
strict-ssl=false
This failed with 418 I'm a teapot error.
registry=https://registry.npmjs.org/
proxy=http://host:8080/
https-proxy=http://host:8080/
strict-ssl=false
This just failed to connect.(ECONNRESET)
registry=https://registry.npmjs.org/
proxy=http://host:8080/
https-proxy=https://host:8080/
strict-ssl=false
Finally this failed with:
write EPROTO 140588447455040:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:252:
How should I set config to install packages through proxy server?
npm version : 6.4.1
OS : ubuntu 18.0.4
I ran into the same issue trying to install gulp.
There is something weird about proxy configuration in npm. It appears that old versions of the proxy & https-proxy settings persist somehow, even if they're not in the config. For me, an old proxy setting, with a previous, expired, password was still present, even after I tried deleting via "npm config delete proxy".
What worked for me was to use
npm config edit
then add in valid entries for proxy and https-proxy. e.g.
proxy=http://[username]:[password]#[proxyhost]:8080/
https-proxy=http://[username]:[password]#[proxyhost]:8080/
It seemed that the https-proxy line was the one that got it working.