npm
查看当前镜像源:
npm config get registry
# https://registry.npmjs.org/
"npm/cnpm 设置镜像地址"继续阅读
npm install <git remote url>
"npm 直接安装 GitHub/GitLab 仓库代码及npm link 本地调试"继续阅读
"前端性能和加载体验优化实践(附:PWA、离线包、内存优化、预渲染)"继续阅读
在项目根目录下面新建文件 .npmrc
,复制下面代码到该文件。
sass_binary_site=https://npm.taobao.org/mirrors/node-sass/
registry=https://registry.npm.taobao.org
NPM 是 Node.js 默认的包管理工具,工作中常使用 npm i
来安装和更新依赖。
"npm i 和 npm ci 区别"继续阅读
"Postman 使用小技巧/指南"继续阅读
peerDependencies
peerDependencies
存在于 NPM 的 package.json
中,如果项目中依赖模块 X、模块 Y,模块 Y 又依赖模块 X,当模块 X 出现版本冲突的时候,则会打包出 X 的两份代码。在这个模块 Y 里面使用 peerDependencies
引入模块 X,这样当前项目和模块 Y 便会共用这个模块 X。
当在 peerDependencies
引入一个模块后:
node_modules
中,什么也不提示。node_modules
中,警告用户缺少此模块,但是不自动安装。注意: npm i
并不会自动安装 peerDependencies
里的模块,所以开发模块的需要在 devDependencies
同步添加相应模块。
peerDependencies
"使用 peerDependencies 缩减项目体积"继续阅读
nodejs
apt-get install curl
curl -sL https://deb.nodesource.com/setup | bash -
apt-get install -y nodejs
"Debian7.8 通过 apt-get 安装 nodejs npm[转]"继续阅读
debian 和 ubuntu 的 apt-get
真是大坑,默认装的 nodejs 竟然不是真正的 nodejs,npm 也有问题。
"debian 和 ubuntu 用 apt-get 安装 nodejs[转]"继续阅读