search

Home  >  Q&A  >  body text

node.js - gulp 离线安装的问题

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

PHP中文网PHP中文网2812 days ago1243

reply all(2)I'll reply

  • PHP中文网

    PHP中文网2017-04-17 16:05:58

    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

    reply
    0
  • 高洛峰

    高洛峰2017-04-17 16:05:58

    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:

    reply
    0
  • Cancelreply