node.js - gulp 离线安装的问题
PHP中文网
PHP中文网 2017-04-17 16:03:58
0
2
1230

1.公司的网络限制下载,无法执行npm -install gulp -g;
2.现在本地项目中有gulp,请问如何执行本地的gulp?或者将本地gulp进行全局安装?

PHP中文网
PHP中文网

认证高级PHP讲师

reply all(2)
洪涛

Thank you, in versions below npm 4 you can directly copy the gulp package to the global module path

/usr/lib/node_modules/

But after npm 4, npm also adopts a flat installation method. The dependencies no longer exist in the gulp package directory, but in the same level directory as the gulp package. Therefore, you need to copy the dependencies to the global module path, but this It’s easy to make mistakes

小葫芦

Seeing the adopted answer, the respondent also said that this is error-prone. I think copying to the global module path, if copied by dragging and other methods under Windows, may fail because the path name of the dependent package is too long.

I just tried the method I mentioned in the comment, npm install <folder> -g

npm install <folder>:
Install a package that is sitting in a folder on the filesystem.

In the beginning, my global npm only had these

So, I went to a vue demo project and found the vue directory

Then

Result:

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template