[NPM] Publish npm packages using npm publish

In this lesson we will publish our package. We will first add a prepublish script that runs our buildscript; this will ensure the built folder gets added to npm when published. We will also add a .npmignore so that only our built files get installed. We need to run npm adduser to log in to an npm account. We can then run npm publish to publish our package and view it on npm.

Note: if you want to actually publish the package from this course, you‘ll need to rename it since sensitive-words is already taken. You can use a scoped package name for this as well.

Inside our .npmigore:

src // ignore, therefore users install our package will not include src folder

script:

"prepublish": "npm run build",

Add prepublish script, so that everytime we publish the lib, will make sure use the latest code.

时间: 2024-11-09 00:59:15

[NPM] Publish npm packages using npm publish的相关文章

npm包的上传npm包的步骤,与更新和下载步骤

官网: ======================================================= 没有账号可以先注册一个,右上角点击"Sign Up",有账号直接点击"Login" 注册与登录账号这些就不详说了,不懂直接重新学习吧!!!!!!!!======================================================= 打开终端:win+r 登录命令:npm login查找用户名命令:npm whoami==

npm淘宝镜像解决npm被墙后无法安装更新包的问题

随着nodejs在编程界发展得风生水起,大家也逐渐开始习惯使用npm来安装和管理项目的包和组件,但是无奈大天朝的"Great Wall"实在是烦不胜烦,总是导致NPM无法访问到目标资源的问题. 但是,总有大牛们会为大家解决这些问题. 淘宝就做了一套国内的npm镜像,同步频率为10分钟一次,基本可以与NPM官方仓库保持同步,所以,只要我们在使用npm命令安装和更新包的时候指定使用淘宝镜像,就会duang的一下下载完成了. 具体命令格式如下: npm install some-npm-mo

npm 安装包失败 --- 清除npm缓存

今天同事给了一个webpack的项目,我拿过来,npm  install 突然出现报错了,并且报了一个奇怪的错误, 如下所示, Unexpected end of JSON input while parsing near ‘--- “https:// github.com/w”’, 安装依赖从来没有失败过,我就和同事说了一下,是不是项目的依赖有问题,他说没有问题,他的项目都已经跑起来,问了一下其它同事,他们安装也没有这样的问题,这就有点无奈了,只有我一个人有问题.为了排查是哪个依赖有问题,我把

执行npm -install -g vue-cli 和 npm install -g cnpm --registry=https://registry.npm.taobao.org时保错

在安装vue淘宝镜像和命令行工具的时候,先进行淘宝镜像安装,安装完成后,再对命令行工具进行安装报错如下: 原因分析:代理地址问题 解决办法:首先清理掉之前异常的下载内容,使用指令:npm cache clean --force 然后修改代理:代理置空     npm config set proxy null npm config set https-proxy null 修改代理: npm config set registry http://registry.cnpmjs.org/ 再执行:

npm install 报错(npm ERR! errno -4048,Error: EPERM: operation not permitted,)解决方法

npm ERR! path E:\SouthernPowerGridProject\web_project\AutoOPS\autoops\node_modules\fsevents\node_modules\dashdash\node_modulesnpm ERR! code EPERMnpm ERR! errno -4048npm ERR! syscall scandirnpm ERR! Error: EPERM: operation not permitted, scandir 'E:\S

(在本地运行项目)npm报错:npm ERR! missing script: start npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\Administrator\AppData\Roaming\npm-cache_logs\2017-11-20T09_43_06_459Z-debug.log

1.克隆项目:gi tclone XXXXX.git(可以在终端运用git命令行下载,也可以直接在webStorm中下载) 2.安装node.js(电脑上已经安装成功,此步骤可省略) 3.安装依赖:进入到项目文件夹内,npm install(由于git上只会存在package.json,而不会存在node_modules,所以需要根据package.json上的内容,在本地重新加载一份node_modules,用来确保vue项目得以运行) 4.启动服务:进入到项目文件夹内,npm run dev

npm执行清理缓存失败npm cache clean

C:\Users\you name>npm cache cleannpm ERR! As of [email protected], the npm cache self-heals from corruption issues and data extracted from the cache is guaranteed to be valid. If you want to make sure everything is consistent, use 'npm cache verify'

【npm permission denied错误】npm ERR! Error: EACCES: permission denied, access

在命令前加上 sudo sudo npm install --save-dev grunt 不过这样子可能还是不行,你需要这样: sudo npm install --unsafe-perm=true --save-dev grunt 或许你还是会遇到错误,请尝试这样: sudo npm install --unsafe-perm=true --allow-root --save-dev grunt 原文地址:https://www.cnblogs.com/zealousness/p/11967

npm: react运行时报错npm start — babel-eslint 版本兼容性问题

最近: $ react-scripts start There might be a problem with the project dependency tree. It is likely not a bug in Create React App, but something you need to fix locally. The react-scripts package provided by Create React App requires a dependency: "web