Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
467 views
in Technique[技术] by (71.8m points)

javascript - 使用npm安装本地模块?(Installing a local module using npm?)

I have a downloaded module repo, I want to install it locally, not globally in another directory?

(我有一个下载的模块库,我想在本地安装它,而不是在另一个目录中全局安装?)

What is an easy way to do this?

(有什么简单的方法可以做到这一点?)

  ask by fancy translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

From the npm-link documentation :

(从npm-link文档中 :)

In the local module directory:

(在本地模块目录中:)

$ cd ./package-dir
$ npm link

In the directory of the project to use the module:

(在要使用模块的项目目录中:)

$ cd ./project-dir
$ npm link package-name

Or in one go using relative paths:

(或一次性使用相对路径:)

$ cd ./project-dir
$ npm link ../package-dir

This is equivalent to using two commands above under the hood.

(这等效于在幕后使用上面的两个命令。)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...