npm 自建 包

发布于:2019-12-19 15:30:36 更新于:2019-12-19 15:57:14

新建本地目录文件夹,初始化

// 新建文件夹 然后
npm init

新建index.js

function hello( name ){
    console.log( "hello" + name )
}
exports.hello = hello

登陆npm账户 登陆和发布需要切换到npm官方源,见下↓

npm adduser
// 输入账户名
// 输入密码
// 输入邮箱

发布

npm publish

切换源

// npm 切换源管理
npm install -g nrm 
nrm use taobao
nrm use npm

评论 0

还没有评论,来抢沙发吧~