Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to "npm install" from AWS S3?

Is there a way to store projects/modules on AWS S3 and do an npm install from a client project?

I've found a way to do an npm install from BitBucket in the npm docs [Go]

I'm trying to find different ways to store common project items (i.e. methods or other resources) to use across microservices.

like image 285
Rod Avatar asked Jul 19 '18 13:07

Rod


People also ask

CAN node JS run on S3?

Instead organize your files in S3 where index. html is the root and files with paths such as js/ css/ images/ taken from the root folder. Note: Its important to understand that you cannot run NodeJS in S3 and instead you will be using the internal web hosting from S3 to serve the static content.


1 Answers

According to the documentation, you should be able to install a package from any url resolving to a gzipped tarball.

So if you expose your bucket content with cloudfront, it should work.

A package is:

  • a) a folder containing a program described by a package.json file
  • b) a gzipped tarball containing (a)
  • c) a url that resolves to (b)
  • d) a @ that is published on the registry with (c)
  • e) a @ that points to (d)
  • f) a that has a "latest" tag satisfying (e)
  • g) a git url that, when cloned, results in (a).

doc : https://docs.npmjs.com/about-packages-and-modules#about-packages

like image 184
Gabriel Bleu Avatar answered Oct 14 '22 12:10

Gabriel Bleu