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开发环境,接下来将尽可能详细的讲述安装过程,帮助新人少 ...
随机推荐
- CentOS 6 网络yum源配置
# CentOS-Base.repo## The mirror system uses the connecting IP address of the client and the# update ...
- csr867x开发日记——常用软件工具介绍
xIDE xIDE开发环境(编译器)可以被用于以下操作 查看代码 构建新应用 调试 运行 重新配置 修改 Universal Front End 通用前端 通用前端(UFE)工具用于配置DSP,ADK ...
- Maven高级应用--编译全模块包-dist包
1. 在需要生成dist包的模块级别,新建文件夹xxx-xxxx-dist 2. 进入目录,新建pom.xml,建议copy 3. dependencies节点,把要编译成全局包的应用引入进来 < ...
- python 3.6.3 异常
内置异常 在Python中,所有异常都必须是派生类的实例 BaseException.在try同一个声明中except 说提到一类特殊条款,该条款还处理来自类(从中但也不例外类派生的任何异常类它派生) ...
- rfcn校招总结
idea:ROI pooling前都是卷积,是具备平移不变性的,但一旦插入ROI pooling之后,后面的网络结构就不再具备平移不变性了,就解决了分类和定位的矛盾,但因为引入roi-wise lay ...
- CentOS gitlab 安装配置
CentOS gitlab 安装配置 2018-11-02 11:23:09 Visit 5 在/etc/yum.repos.d 目录下创建文件gitlab-ce.repo,使用国内的安装源 b ...
- 【luogu P1666 前缀单词】 题解
题目链接:https://www.luogu.org/problemnew/show/P1666 10.13考试题 当时没想出来,觉得是要用trie做,在trie上跑一个树形dp 结果是写了个子集枚举 ...
- OpenFlow, SDN, and NFV
OpenFlow An open standard to innovative protocols in production networks provides a standardized hoo ...
- 增加oracle表空间
查找用户对应的表空间 1.查询表空间物理文件路径select tablespace_name, file_id, file_name,round(bytes/(1024*1024),0) total_ ...
- IOS中Hybird实现
现在Hybird这块,网上也有很多文章,最近研究了下,分享给大家. 什么是Hybird技术? 1.一般是指WebView和Native技术混合而成的一套技术方案 2.也可以理解成,非Native技术与 ...