npm config set registry https://registry.npm.taobao.org/ npm config set disturl https://npm.taobao.org/dist/ npm config set electron_mirror https://npm.taobao.org/mirrors/electron/ npm config set electron_builder_binaries_mirror https://npm.taobao.org/mirrors/electron-builder-binaries/ npm config set node_sqlite3_binary_host_mirror https://npm.taobao.org/mirrors npm config set sass_binary_site https://npm.taobao.org/mirrors/node-sass/ npm config set phantomjs_cdnurl https://npm.taobao.org/mirrors/phantomjs/ npm config set chromedriver_cdnurl https://npm.taobao.org/mirrors/chromedriver/ npm config set operadriver_cdnurl https://npm.taobao.org/mirrors/operadriver/ npm config set python_mirror https://npm.taobao.org/mirrors/python/
npm install typescript -g npm install webpack -g npm install webpack-dev-server -g npm install ts-loader -g npm install css-loader style-loader -g
npm config get userconfig npm config get globalconfig 查看npm配置信息 npm config ls npm config ls -l
查看npm的prefix和cache路径配置信息 npm config get cache npm config get prefix 修改 npm config set cache "new/path1/" npm config set prefix "new/path2/" 全局node_modules文件夹位置: npm root -g
npm list npm -g list npm ls mysql npm info mysql npm outdated
下载全局依赖,存储在cache, prefix指定的路径下 npm install -g x npm install <pkg>@<version> npm install --no-optional npm update <pkg>@<version> npm uninstall <pkg> npm uninstall <name>@[<version>] npm cache add:官方解释说这个命令主要是 npm 内部使用,可是也能够用来手动给一个指定的 package 添加缓存。 npm cache clean:删除缓存目录下的全部数据,为了保证缓存数据的完整性,须要加上 --force 参数。 npm cache verify:验证缓存数据的有效性和完整性,清理垃圾数据。 基于缓存数据,npm 提供了离线安装模式,分别有如下几种: --prefer-offline:优先使用缓存数据,若是没有匹配的缓存数据,则从远程仓库下载。 --prefer-online:优先使用网络数据,若是网络数据请求失败,再去请求缓存数据,这种模式能够及时获取最新的模块。 --offline:不请求网络,直接使用缓存数据,一旦缓存数据不存在,则安装失败。
npm cache verify npm cache clean npm cache clean --force
查看仓库里某有pkg的信息 npm view tsc npm view tsc version
npm help npm help install
^4.3.1 <==> >=4.3.1 < 4.4.0 ^4.3 <==> >=4.3.0 < 4.4.0 4.3.X <==> >=4.3.0 < 4.4.0 4.3 <==> 4.3.X
https://www.jianshu.com/p/bc24310edf26 https://docs.npmjs.com/misc/config http://www.godrry.com/archives/in-short-the-overall-process-of-npm-install.html
仅做为开发阶段依赖 npm i express --save-dev 查看express的版本 npm ls express 查看整个工程的依赖 npm ls 查看全局安装的依赖包 npm ls -g npm list -g --depth 0 查看本工程依赖安装位置 npm root 查看全局依赖安装位置 npm root -g
手动下载chromium
后放到指定文件夹
https://npm.taobao.org/mirrors/chromium-browser-snapshots/css
.npmrc`html
PUPPETEER_DOWNLOAD_HOST=https://npm.taobao.org/mirrors
chromium
env PUPPETEER_SKIP_CHROMIUM_DOWNLOAD="true" npm i --save puppeteer