1

I have a question about how NPM works. When I install a library globally or on a project, at times node-gyp is used and at other times not for the same library Let me explain, I work in a company with a strict security policy, that is to say that we don't have direct access to the Internet, we go through internal tools and configurations.

For example, for the NX library:

When I don't have the configuration of my company and I am directly on the internet. Installing NX goes perfectly, no need for Python etc. In verbose mode I see a node-gyp rebuild, but it doesn't block the install.

When I have my company's npmrc file, the NX library install asks for Python, the C++ sdk, etc.

Why in one case NPM should not rebuild and in the other case it should? Does anyone have an explanation to this ?

In our npmrc file, we modify the registry variable to go through our Artifactory.

Thank you in advance for your explanations

  • 1
    Depending on your operating system and architecture generally packages have pre-built binaries. But since you said that you're using a private registry with restricted internet, it is likely that through your network, npm is unable to fetch those binaries and needs to build the packages locally. Its also possible that your org's systems don't have any pre-built binary available for them, while your personal system has. – brc-dd Jul 15 '22 at 09:37
  • Thank you for your answer, as explained, indeed, it is the same computer. How do I see the binary it's trying to find, as I don't see a timeout or anything in verbose mode. – 1811L2201DA Jul 15 '22 at 10:16
  • 1
    Maybe use something like `tcpdump` or Wireshark to inspect network requests? There might be caching, so you might need to do something like `npm i --cache path/to/random/empty/dir` to bypass it. – brc-dd Jul 15 '22 at 10:23

0 Answers0