openSUSE / npm-localhost-proxy

A localhost proxy serving NPM tarballs allowing npm install in a non-networked system.
GNU General Public License v3.0
3 stars 3 forks source link

Not working with modern NPM installations #8

Open marcosbc opened 1 month ago

marcosbc commented 1 month ago

Currently, if we try to run it on a project with a modern NPM installation, it fails with a cryptic error. The example below is happening when running for Prometheus:

[    3s] + local-npm-registry /home/abuild/rpmbuild/SOURCES install --legacy-peer-deps --ignore-scripts
[    5s] Serving 1406 packages
[    5s] { address: '127.0.0.1', family: 'IPv4', port: 34697 }
[    6s] request: (bad method)/-/npm/v1/security/advisories/bulk
...
[   10s] npm error code E400
[   10s] npm error 400 Invalid path - GET http://localhost:34697/yallist/-/yallist-3.1.1.tgz
[   10s]
[   10s] npm error A complete log of this run can be found in: /home/abuild/.npm/_logs/2024-09-24T15_42_34_463Z-debug-0.log
[   10s] An error occurred: NPM returned code: 1

The issue seems to be that this project does not support these URLs: http://localhost:34697/yallist/-/yallist-3.1.1.tgz. Checking the code, it seems like in the past, NPM would reference these URLs like this: http://localhost:34697/-/yallist-3.1.1.tgz.