博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
深入浅出Node.js (附录D) - 搭建局域NPM仓库
阅读量:6602 次
发布时间:2019-06-24

本文共 2573 字,大约阅读时间需要 8 分钟。

D.1  NPM仓库的安装

  D.1.1  安装Erlang和CouchDB
  D.1.2  搭建NPM仓库
D.2  高阶应用
  D.2.1  镜像仓库
  D.2.2  私有模块应用
  D.2.3  纯私有仓库
D.3  总结
D.4  参考资源

1. what is npm

-- To upgrade: run: [sudo] npm install npm@latest -g
2. Installing Node.js and updating npm
-- node -v to test. The version should be higher than v0.10.32
-- sudo npm install npm -g
-- npm -v to test. The version should be higher than 2.1.8
3. Fixing npm permissions
-- find the path to npm's directory: npm config get prefix
-- change owner: sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share} 
4. Installing npm packages locally
-- npm install <package_name>
-- ls node_modules
5. Using a package.json
-- To create package.json, run: npm init --yes
-- npm set init.author.email "wombat@npm.com" 
6. Updating local packages
-- npm update in the same directory as your package.json file
-- npm outdated to test
7. Uninstalling local packages
-- npm uninstall <package>
-- npm uninstall --save <package>
8. Installing npm packages locally
-- npm install -g <package_name>
-- sudo npm install -g <package>
9. Updating local packages
-- npm install -g <package>
-- npm outdated -g --depth=0 to find out which packages need to be updated
-- npm update -g to update all global packages
10. Uninstalling local packages
-- npm uninstall -g <package>
11. Creating Node.js module
author: Your Name <email@example.com> (http://example.com)
--Publish your package to npm
--Make a new directory outside of your project and cd into it
--Run npm install <package>
--Create a test.js file which requires the package and calls the method
--Run node test.js. The message should be output.
12. Publishing npm packages
--npm adduser/npm login to store the credentials on the client
--npm config ls
--npm publish. to check: https://npmjs.com/package/<package>
--npm version patch and npm publish to update package

13. Semantic versioning and npm

14. Working with scoped packages

-- @scope/project-name package's name begin with @, then it is a scoped package.
-- @username/project-name
--sudo npm install -g npm
--npm login
--npm init --scope=username package.json: {"name": "@username/project-name"}
--.npmrc npm config set scope username
--npm publish --access=public
--npm install @username/project-name --save
var projectName = require('@username/project-name')
15. Using dist-tags
--Tags are a supplement to semver for organizing and labeling different versions of packages.
--npm dist-tag add <pkg>@<version> [<tag>]
--npm publish --tag beta
--npm install somepkg@beta

转载于:https://www.cnblogs.com/thlzhf/p/5155936.html

你可能感兴趣的文章
HTML5 定位
查看>>
禁止http 缓存的方法
查看>>
python windows下安装pip(三)
查看>>
Android图像处理(二)--Paint,Canvas,ColorMatrix详细
查看>>
Android 百度地图
查看>>
iOS 架构(起手式)
查看>>
FilterDispatcher处理流程
查看>>
基于云平台部署应用的三种方式
查看>>
正确使用 Volatile 变量
查看>>
我的友情链接
查看>>
持续集成
查看>>
我的友情链接
查看>>
ubuntu下配置tomcat的步骤;
查看>>
python学习随笔--django 上
查看>>
安装WEB_shell开源堡垒机 gateone
查看>>
高性能HTTP加速器Varnish(安装配置)
查看>>
软件技术发展的几个阶段
查看>>
查看WINXP系统关机时间 so-easy
查看>>
修改mysql数据库编码
查看>>
代码审查RhodeCode试用
查看>>