使用npm link 加速调试

我们在把包发布到npm上时,如果需要对本地的包进行修改,我们需要改变一个版本,重新发布。然后测试时需要更新这个包进行测试。这样的话,每一次的调试都特别麻烦。我们可以使用npm link来加速这个调试过程。

步骤1:在项目根目录下运行npm link

npm link

步骤2:在项目之外使用到这个包的根目录下运行npm link xxx

npm link + 包的名称

步骤3: 当项目中进行了修改时,项目外就能够获得最新的代码了。

原文地址:https://www.cnblogs.com/yinhaiying/p/11331028.html

时间: 2024-08-09 03:42:14

使用npm link 加速调试的相关文章

[Node.js] Using npm link to use node modules that are "in progress"

It is some times convenient, even necessary, to make use of a module that you are working on before it has been published to the node package manager (npm). The npm link command makes this simple. For example: upper/index.js: module.exports = functio

[NPM] Test npm packages locally in another project using npm link

We will import our newly published package into a new project locally to make sure everything is working as expected. We can do this locally before publishing with npm link. This creates a symbolic link in our node_modules folder, so our unpublished

npm link实践演示

如果你用npm这个包管理来安装node包的话,只能是该包的开发者已经传到npm上面的版本. 但是有时候,一些开源的包,如果修复了一些bug或新增一些新功能之后,但是还没有更新到npm上面.这个时候,你无法通过npm install来获取该包最新的代码. npm link可以做到,我们项目里面用到的pomelo这个包,就是通过npm link来使我们所用的pomelo代码是最新的. 下面用wechat这个包来举例并演示说明. 1. 2. 3. 4. 5. 6. 7. 8. 9. 参考资料 http

npm link 的用法

npm link 的用法 先到对应的自定义包下执行 npm link 会读取对应的 packagejson 中的名称 然后到对应的目录下执行 npm link your/own/npm/name 就会看到对应的提示 原文地址:https://www.cnblogs.com/asdfq/p/10994227.html

npm link用法总结

npm link用来在本地项目和本地npm模块之间建立连接,可以在本地进行模块测试 具体用法: 1. 项目和模块在同一个目录下,可以使用相对路径 npm link ../module 2. 项目和模块不在同一个目录下 cd到模块目录,npm link,进行全局link cd到项目目录,npm link 模块名(package.json中的name) 3. 解除link 解除项目和模块link,项目目录下,npm unlink 模块名 解除模块全局link,模块目录下,npm unlink 模块名

React Native开发之npm start加速

在Windows下好不容易安装好React Native环境之后,运行npm start,结果就是无限被等待,快的话160秒(将近3分钟啊....) 而Mac下因为有watchman所以是飞一样的速度,1秒不到,一般几十到几百毫秒.此处一千一万只草泥飞在胸中奔腾-   所幸找到一个解决方案了,能让npm start也飞起来(500毫秒左右),操作步骤如下: 1.安装watchman,在Windows下暂时处于alpha版本但是可以使用,是一个zip包 https://facebook.githu

npm安装加速

1.通过config命令 npm config set registry https://registry.npm.taobao.org npm info underscore (如果上面配置正确这个命令会有字符串response) 2.命令行指定 npm --registry https://registry.npm.taobao.org info underscore 3.编辑 ~/.npmrc 加入下面内容 registry = https://registry.npm.taobao.or

npm package.json属性详解

章节目录 概述 name version description keywords homepage bugs license 和用户相关的属性: author, contributors files main bin man directories directories.lib directories.bin directories.man directories.doc directories.example repository scripts config dependencies U

NPM使用技巧

如果你是一个JavaScript系的开发者,一定不会陌生NPM,它既是一个平台,也是一个工具.在这个平台上,我们能够使用其他开发者提供的功能代码,当然我们也能将我们自己代码提交到这里分享给世界上的开发者. 以下记录一些NPM作为工具的一些使用技巧. npmrc .npmrc 做为npm的配置文件,它可以定义在多个地方. ~/.npmrc 用户根目录,根目录内所有的npm指令都会查询到该配置 /path/to/npm/npmrc npm内建配置文件 ./.npmrc 当前项目根目录,用于配置特定于