当前位置:网站首页>Brief introduction and use of NPM link
Brief introduction and use of NPM link
2022-07-26 02:18:00 【Idle fish_ JavaScript】
Brief introduction
- This is very convenient for installing things written by yourself , So you can work on it and iterate tests , Instead of constantly rebuilding .
- The vernacular above is : You wrote your own npm modular , Want to test , have access to npm link To global , Then reference tests elsewhere
Use
- Your encapsulated module ( Project name: : myModules, Project path :d:\xxxxxx\xxxxx\x\myModules) You go to the test place ( Project name: test, The project path is :d:\test); reminder : Project name: package.json Medium name;
- stay myModules Enter under the project cmd Little black frame , Then input npm link;( Be careful : There is no need to follow any name here )
npm link
- Then go to test Project entry cmd Small black box input npm link myModules;( Be careful : Here you need to add the name of the module you are about to connect , That is, in your module package.json Medium name Field )
npm link myModules
- When you succeed, you will be prompted ( The connection address points to the prompt )
- problem 1: If appear to npm When you search the address or your private server address, it means that the module name you wrote is wrong ! Please copy and paste your name , Otherwise, the place where you mount is not the root directory of your module (npm link Need to run in your root directory )
- test : If it's just a method , Suggest direct node index.js;(node Run the test )( Be careful : This method gets commonjs standard 【 expose :module、module.exports, introduce :require(‘ File address or module name ’)】)
- After the test , Need to cancel link, Test item input npm unlink myModules Cancel the corresponding module ;myModules Enter npm unlink Cancel the global module mount ;
// The test item is not mounted
npm unlink myModules
// myModules Cancel the project mounting
npm unlink
Sample code
package.js in main The field refers to the address , Please configure to your module address ;(myModules/package.json)
{
"name": "myModules",
"version": "1.0.0",
"description": "",
"main": "src/index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC"
}
The main content of the module (myModules/src/index.js)
const myModules = res => res
module.exports = myModules
quote (test/index.js)
const myModules = require('myModules')
const data = require('./data.js')
console.log(myModules(new Uint8Array(data)), 'test')
边栏推荐
- SQL manual blind injection and error reporting injection
- Ti AM335X工控模块矩阵键盘电路的设计与驱动移植
- 1. Mx6ul core module uses serial NAND FLASH read / write test (III)
- Handling process of the problem that the virtual machine's intranet communication Ping fails
- scipy.sparse.vstack
- Are you still using ==0 null equal to judge null values? How much do you know about isempty and isblank
- [paper reading] coat: CO scale conv attentional image transformers
- Ti AM335X工控模块使用beaglebone(bbb)的Debian系统
- (CVPR 2019) GSPN: Generative Shape Proposal Network for 3D Instance Segmentation in Point Cloud
- [2019] [paper notes] tunable THz broadband absorption based on metamaterials——
猜你喜欢

I.MX6UL核心模块使用连载-查看系统信息 (二)
![[2020] [paper notes] growth of bi2te3/cofeb double-layer heterojunction by magnetron sputtering——](/img/5d/7d26e2d0d832c95e1cc011995ce774.png)
[2020] [paper notes] growth of bi2te3/cofeb double-layer heterojunction by magnetron sputtering——
![[xxl-job] xxl-job learning](/img/2c/d3872983e4228a3ef52a9d1bef836e.png)
[xxl-job] xxl-job learning

信息系统项目管理师---第十章沟通管理和干系人管理历年考题

I.MX6UL核心模块使用连载-CAN、蜂鸣器测试 (十一)

The slow loading of the first entry page of vite local operation

Business Intelligence BI full analysis, explore the essence and development trend of Bi

Prometheus + redis exporter + grafana monitor redis service

我来图书馆小程序一键签到和一键抢位置工具

CD from grabbing the track to building a streaming media server -- a case study of "moon in the hometown of sleep"
随机推荐
MySQL(4)
I.MX6UL核心模块使用连载-USB接口测试 (六)
17_ Form Data
numpy.sort
1. Mx6ul core module use serial TF card read / write test (V)
[2021] [paper notes] 6G technology vision - otfs modulation technology
prometheus+redis-exporter+grafana 监控redis服务
Li Kou 148: sorting linked list
I.MX6UL核心模块使用连载-查看系统信息 (二)
Obsidian mobile PC segment synchronization
增删改查业务的快速上手
Adruino 基础实验学习(一)
I.MX6UL核心模块使用连载-以太网测试 (七)
[cloud native] 4.1 Devops foundation and Practice
19_请求表单与文件
Postman reported JSON serialization error
Acwing 379. hide and seek problem solution (minimum path non repeating point coverage)
Data warehouse: Practice of hierarchical structure of data warehouse in banking industry
18_ Request file
I.MX6UL核心模块使用连载-触摸屏校准 (九)