mixu/npm_lazy

Support for caching npm scoped packages (e.g @angular)

capi opened this issue · 4 comments

capi commented

Angular2, as part of their first release-candidate 2.0.0-rc.0 switched to using the scope @angular. The current implementation of Package.isPrivate() treats this as a private package, since it starts with @.

I tried patching isPrivate() to return false, but there seem to be other places that break with the scopes.

Is it possible to add support for caching such scoped packages?

mixu commented

@capi - thanks for filing this issue. I gave it a try and added support for scoped modules in v.1.10.0. Let me know if you run into any issues!

capi commented

Seems to be working fine! Thanks a lot for your fast response!

Hello,

I am using 1.12.0.
I am unable to retrieve @angular dependencies.
It works without npm lazy, but it fails with it.

Client logs:

npm http 404 https://npm.cosium.com/@angular%2fforms
npm verb bad json <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
npm verb bad json <html><head>
npm verb bad json <title>404 Not Found</title>
npm verb bad json </head><body>
npm verb bad json <h1>Not Found</h1>
npm verb bad json <p>The requested URL /@angular/forms was not found on this server.</p>
npm verb bad json </body></html>
npm verb bad json 
npm ERR! registry error parsing json
npm verb headers { date: 'Mon, 29 Aug 2016 17:55:37 GMT',
npm verb headers   server: 'Apache',
npm verb headers   vary: 'Accept-Encoding',
npm verb headers   'content-encoding': 'gzip',
npm verb headers   'content-length': '185',
npm verb headers   'keep-alive': 'timeout=15, max=100',
npm verb headers   connection: 'Keep-Alive',
npm verb headers   'content-type': 'text/html; charset=iso-8859-1' }

Nothing about @angular in server logs.

Can we reopen this issue?

Hello,
I am facing the same issue as @reda-alaoui ,where the name of the scoped package gets decoded and cannot be found in the repository.

e.g If I want @osc/koal from npm_lazy cache server. It will call for @OSC%2fkoal.

app info Request from ip: 10.xx.xx.xx for /@osc%2fkoal
app debug [GET] https://registry.npmjs.com/@osc%2fkoal

error [404] Error:  { [Error: URL is not in the npm_lazy cache, and it cannot be fetched (max retries exhausted): https://registry.npmjs.com/@osc%2fkoal]
  statusCode: 404,
  contentStream: null,
  content: '{"error":"Not found"}' }

Can anyone share solution or workaround for this .