Jenkins npm/gulp proxy setup - node.js

My client project is build via gulp & I would like to configure ci with Jenkins. I have a batch file to execute
npm install
gulp build
I am behind a authenticating proxy, Jenkins do not pickup proxy details even though I have setup
npm config set proxy http://proxy.company.com:8080
npm config set https-proxy http://proxy.company.com:8080
& even setup HTTP_PROXY env variable on my Jenkins.
I there a Jenkins plugin for gulp?

The root cause was that Jenkins was running as a different user. When I change the Logon details of the Jenkins process to a user where PROXY details are setup, everything works fine.

Related

why gitlab runner don't use my custom npm registry but use the default npm registry

I installed a gitlab runner on my window machine
and I run terminal input "npm config set registry http://my/custom/npm/registry"
and then i trigger a pipeline on my gitlab web page
i saw the terminal pannel show me a default registry value after run "npm config get registry"
why ??
did the gitlab runner doesn't use my npm config on the local machine ?
also, i use nrm to switch the npm registry, i got the same result
Try moving your npm config set registry https://custom-registry.example.com inside your job specification instead of on your host. So for example:
npm_dependencies:
stage: npm
before_script:
- npm config set registry https://custom-registry.example.com
script:
- npm config get registry
- npm install

How to set npm config set proxy on npm start

Hi I'm trying to set a proxy every time I run a specific project with my npm run dev command.
I have something like https://www.npmjs.com/package/dotenv setting up my environment variables but I'm also looking to automating setting my
npm config set proxy http://proxy.example.com:1337
npm config set https-proxy https://proxy.example.com:1337
Does anyone have any solutions for this?
Note That I only want this for my development and note production.
For setting proxy and other configuration for npm just type the following command in the console
npm config edit
this command will open the .npmrc file, in that file set the proxy and other setting related npm
hope it will works.
npm config set proxy http://proxy.example.com:1337 will set the proxy for downloading the packages from npm repo.
when you run npm run dev, what is running is your app which is invoked by npm on node.js on your OS, so you need to set a proxy for your app or your OS.
System level proxy
Linux
https://askubuntu.com/questions/583797/how-to-set-a-proxy-for-terminal
Windows:
set http_proxy=socks5://127.0.0.1:1080
set https_proxy=socks5://127.0.0.1:1080
set ftp_proxy=socks5://127.0.0.1:1080
// unset
set http_proxy=
set https_proxy=
set ftp_proxy=
App level
I can't do anything about that.
Webpack dev server
I believe this is what you need, if you are using webpack dev server.
https://github.com/webpack/webpack-dev-server/blob/master/examples/general/proxy-simple/webpack.config.js

Angular CLI fails on downloading Angular 6 dependencies thru proxy behind

I've successfully installed Angular CLI using NPM behind proxy with Fiddler.
But now I'm facing problem when using 'ng new' command of Angular CLI.
It Always fails to download some dependencies that gives me E502 error.
here is the configuration I used for NPM:
npm config set proxy=http://myproxyserveraddress:8888/
npm config set https-proxy=http://username:password#myproxyserveraddress:8888/
npm config set strict-ssl=false
npm config set registry=https://registry.npmjs.org/
for fiddler, I put check on the Auto Authenticate on the Rules menu.
I also tried the other NPM configurations that was posted here but no luck and those instructions looks outdated now.
Is there an updated configuration setting for creating new project in Angular CLI thru proxy behind?
npm config set proxy http://username:password#myproxyserveraddress:8888/
I think you need set the usn and password in both http and http. And, the character between "proxy" and "http" is a "space" not "=" . Or you can check the username. Ex: my usn in company is xxxx\xxxxxx

How to configure .pac file for proxy script in node.js + pac-resolver

I am not able to install any module using npm command. I have below result when When i run npm config list command i get below output.
https-proxy = "http://host.name.changed:80/"
proxy = "http://host.name.changed:80/"
registry = "http://registry.npmjs.org/"
The proxy configured in my internet explorer is having proxy.pac file as below without any port.
http://host.name.changed/proxy.pac
if https://www.npmjs.com/package/pac-resolver/v/3.0.0 is the answer, how do I Install pac-resolver even npm install pac-resolver does not work !!
First, take a look at this question and answer for configuring npm's proxy. The pac-resolver package would just allow you to see which proxy the pac file is resolving to when requesting a page from some host, so there is no need to use it in order to utilize npm.
Second, most command line tools like npm are not configured to use IE's proxy settings so in most cases you'll have to configure this in a file somewhere. .npmrc in npm's case.
Also checkout cntlm which can simplify proxy configuration for your system.

npm windows installation proxy issue

I am using below commands to setup proxy on window7
npm config set proxy http://<username>:<password>#<proxy-server-url>:<port>
npm config set https-proxy http://<username>:<password>#<proxy-server-url>:<port>
but I am not able to setup proxy correctly and when I am trying to run the command
npm config get proxy
I am getting erroneous proxy URL as below
http://<username>/:<password>#<proxy-server-url>:<port>
and
it seems slash before colon between "username:password" is getting added incorrectly as "username/:password".
How do I correctly configure npm proxy on windows?
write command in cmd(admin):
this work for me in w10
npm config set https-proxy http://username:password#proxy:port

Resources