Using NpUsing Npm Behindm Behind a Corporate Proxy

On a recent assignment, I needed to install npm behind a corporate proxy. I had already set the environment variables HTTP_PROXY and HTTPS_PROXY. Other command line utilities, like ruby gems, recognized these environment variables. Npm did not.

After some googling, I found the following way to configure the proxy for npm.

npm config set proxy http://proxy.company.com:8080
npm config set https-proxy http://proxy.company.com:8080

If you need to specify credentials, they can be passed in the url using the following syntax.

http://user_name:[email protected]:8080

Further exploration of the npm config documentation showed that the npm config set command sets the proxy configuration in your .npmrc file. You can also set the proxy configuration as a command line argument or environment variable.

Configuration parameters can be specified using -- when executing npm. So the proxy could also be specified as follows.

npm --https-proxy=http://proxy.company.com:8080 -g install karma

To pass configurattion parameters to npm as environment variables, they must be prefixed with npm_config_. The proxy configuration could be set with environment variables as follows.

export npm_config_proxy http://proxy.company.com:8080
export npm_config_https_proxy http://proxy.company.com:8080

时间: 2024-08-28 22:46:44

Using NpUsing Npm Behindm Behind a Corporate Proxy的相关文章

NPM, BOWER, GIT, AND BASH PROXY CONFIGURATIONS

Sources: http://digitaldrummerj.me/proxy-configurations/ When you are using npm, bower, and git behind a proxy server you have to do a little bit of configuration. Luckily it is super easy to do these configurations. Almost all of the programs have c

如何在NTLM的代理的后面,使用npm安装node.js的扩展

今天有些时间学习新知识了. 另一个项目,实现了第一阶段的联调的通过.静下心来几天,庆祝一下这个节点. 顺便学习node.js 一个重要的要解决的问题,就是如何在NTLM后面,使用npm. 事实上,这是一个古老的,linux体系的一个大bug: 设置代理时,不能使用域,只能使用有主机名的(好象iMac解决了). 今天找了一上午,终于找到一个可能的办法: http://stackoverflow.com/questions/18569054/npm-behind-ntlm-proxy 原理就是,先在

Nodejs in Visual Studio Code 08.企业网与CNPM

1.开始 CNPM : https://npm.taobao.org/ 2.企业网HTTP代理上网 平时办公在一个大企业网(10.*.*.*)中,使用HTTP代理上网,发现npm命令无法执行. 解决方案如下: 1.安装并设置好Proxifier,https://www.proxifier.com Proxifier有效解决了node.exe不会找浏览器中设置的代理作为默认代理来执行的尴尬悲剧. 2.安装Shadowsocks,买个VPS,装个服务端,碰到NPM抽风的时候使用--proxy htt

【微服务轻量化容器技术相关】同事分享的Docker学习汇总

还没时间去练习: Docker commands: docker images (list all image on this host) docker ps -a ( list all containers on this host) docker run -t -i centos6_oodee /bin/bash ( create a container with command) docker start 091a802729cd ( start one instance of the c

各种坑之遇险记

how to access share folder in ubuntu virtualbox sudo adduser [username] vboxsf enable root and ssh root login step 1:    sudo passwd root step 2: sudo passwd -u root  you want to work on a root console you can also use    sudo -i If you want to disab

gradle使用dokka插件出现Exception while loading package-list from ExternalDocumentationLinkImp

这是一个月多前遇到的问题,现在特做记录: build.gradle.kts里配置了dokka插件的时候出现这个异常,Exception while loading package-list from ExternalDocumentationLinkImp dokka是gradle的一个插件,功能类似与javadoc.对于这个异常当时看了好多博客也都不行,最终找到dokka的github的一个问题单: https://github.com/Kotlin/dokka/issues/213# 当时一

基于vue2+nuxt构建的高仿饿了么(2018版)

前言 高仿饿了么,以nuxt作为vue的服务端渲染,适合刚接触或者准备上vue ssr的同学参考和学习 项目地址如遇网络不佳,请移步国内镜像加速节点 效果演示 查看demo请戳这里(请用chrome手机模式预览) 移动端扫描下方二维码 API接口文档 接口文档地址(基于apidoc) 技术栈 vue2 + vuex + vue-router + mint-ui + nuxt 项目运行 git clone [email protected]:EasyTuan/nuxt-elm.git # 国内镜像

nodeJs 使用 express-http-proxy 转发请求

开发过程中经常需要用到 nodeJs做转发层 使用express配合 express-http-proxy 可以轻松的完成转发 使用过程: 安装 express-http-proxy npm install express --save npm install express-http-proxy --save 创建proxy实例 var proxy = require('express-http-proxy'); 将客户端请求转达到 http://localhost:3001 上: app.u

nuxtjs踩坑指南

1.nuxt引入问题:Can't resolve 'stylus-loader' 原因在于没有安装stylus,安装即可:npm install stylus stylus-loader --save-dev 2.nuxt生命周期: 众所周知,Vue的生命周期全都跑在客户端(浏览器),而Nuxt的生命周期有些在服务端(Node),客户端,甚至两边都在 生命周期流程图,红框内的是Nuxt的生命周期(运行在服务端),黄框内同时运行在服务端&&客户端上,绿框内则运行在客户端 (1)红框.黄框内的