create a nodejs npm package
1. create a folder named m1
2. run command: npm init, this will create the package.json file
3. create a lib folder using command: mkdir lib
4. create index.js using : touch index.js
5. run command : vim index.js , writing following content into it
module.exports=function(){
this.hi=function(){
console.log('hi in index');
} console.log('index file in m1'); }
6. type :w :q to save and quit editing mode
7. To install m1 module to your project , you can use command: npm install ../m1
8. To visit your module code
var ma1=require('../m1');// require('../m1/lib/a');
var ma1ins=new ma1();
ma1ins.hi();
reference:
http://nqdeng.github.io/7-days-nodejs/#2.2.1
create a nodejs npm package的更多相关文章
- npm安装socket.io时报错的解决方法(npm WARN enoent ENOENT: no such file or directory, open '/usr/local/nodejs/bin/package.json')
执行 npm install socket.io安装时报错: [root@WEB node_modules]# npm install socket.ionpm WARN enoent ENOENT: ...
- [WASM Rust] Create and Publish a NPM Package Containing Rust Generated WebAssembly using wasm-pack
wasm-pack is a tool that seeks to be a one-stop shop for building and working with Rust generated We ...
- ubuntu14.04下nodejs + npm + bower的安装、调试和部署
1. 简介 本文介绍ubuntu14.04下nodejs+npm+bower的安装.调试和部署 参考文档 https://docs.npmjs.com/getting-started https: ...
- [NPM + React] Prepare a Custom React Hook to be Published as an npm Package
Before we publish our package, we want to make sure everything is set up correctly. We’ll cover vers ...
- AX7: CREATE AN AUTOMATED TEST PACKAGE\MODEL
AX7: CREATE AN AUTOMATED TEST PACKAGE\MODEL It’s really important for a stable solution the use of a ...
- Windows环境下的NodeJS+NPM+Bower安装配置步骤
Windows下的NodeJS安装是比较方便的(v0.6.0版本之后,支持windows native),只需要登陆官网(http://nodejs.org/),便可以看到首页的“INSTALL”按钮 ...
- Windows 系统下设置Nodejs NPM全局路径
Windows下的Nodejs npm路径是appdata,很不爽,想改回来,但是在cmd下执行以下命令也无效 npm config set cache "D:\nodejs\node_ca ...
- [Node.js] Configuring npm package.json scripts
With a node package manager's (npm) package.json script property, you can preconfigure common tasks ...
- 【前端】Ubuntu16下nodejs+npm+vue环境配置
笔者最近在学习vue.js,不过一直都是在runoob上面各种尝试.今天笔者在本机(Ubuntu16.04)尝试部署了nodejs+npm+vue开发环境,接下来将尽可能详细的讲述安装过程,帮助新人少 ...
随机推荐
- 1100 final standings
http://acm.timus.ru/problem.aspx?space=1&num=1100 link to the problem make a fast stable sorting ...
- 「C语言」常量和变量的表示、应用和变量命名规则
在程序运行中,其值不能改变的量成为常量. 在基本数据类型中,常量可分为整型常量.实型常量.符号常量和字符型常量(包括字符常量和字符串常量),现分别介绍如下: 目录: 一.常量 二.C语言标识符 三.变 ...
- 为什么说 Java 程序员必须掌握 Spring Boot ?
原作者https://www.cnblogs.com/ityouknow/p/9175980.html Spring Boot 2.0 的推出又激起了一阵学习 Spring Boot 热,就单从我个人 ...
- redis三节点sentinel部署
角色 ip port master 127.0.0.1 6379 slave-1 127.0.0.1 6380 slave-2 127. ...
- DispatcherServlet类的分析
突然发现拿博客园来做笔记挺好的,不会弄丢.下面我把DispatcherServlet类的部分源代码复制到这里,然后阅读,把重要的地方翻译一下,该做笔记的地方做下笔记,蹩脚英语. =========== ...
- Linux_脚本——使用echo从一个文件写入还有一个文件末尾
版权声明:本文为博主原创文章,未经博主同意不得转载. https://blog.csdn.net/svitter/article/details/30980923 echo $(cat 你须要的文件) ...
- 安卓渗透测试工具Drozer学习笔记
下载,并安装. pip安装即可,安装完成后可能会出现缺少twisted依赖库的问题 ➜ vul git:(master) ✗ drozer console connect drozer Server ...
- 2018 Multi-University Training Contest 4 Problem B. Harvest of Apples 【莫队+排列组合+逆元预处理技巧】
任意门:http://acm.hdu.edu.cn/showproblem.php?pid=6333 Problem B. Harvest of Apples Time Limit: 4000/200 ...
- springmvc和easyui使用ajax前台后台互传数据,假删除提示警告问题。
前台 //删除 多/单条数据 function del(cid){ var id=''; if(cid=='-1'){ if(getSelections().length > 0){ id=ge ...
- @RestController失效
@RestController 注解失效.就是本来应该是直接返回数据.而不是去查找视图.但是去查找视图了.我这人不喜欢弄一些无用的配置文件.所以用到什么.引用什么.但是也容易犯错误.不过也好.对哪里出 ...