1

i was use Verdaccio which is a lightweight private npm proxy registry built in Node.js

when i publish my code to verdaccio ,it always have a Error:

enter image description here

the logs file key word: 15 notice === Tarball Details === 16 notice name: canwin-viewer3d 16 notice version: 1.0.0 16 notice package size: 21.9 MB 16 notice unpacked size: 50.4 MB 16 notice shasum: 63d555be03e0c7a7b6dcdfb662d29c48b21d8c53 16 notice integrity: sha512-KFz0gTPJusdfV[...]VIeII6rrcv4IA== 16 notice total files: 733 17 notice 18 http fetch PUT 413 http://localhost:4873/canwin-viewer3d 677ms 19 verbose stack Error: 413 Payload Too Large - PUT http://localhost:4873/canwin-viewer3d - request entity too large 19 verbose stack at C:\Program Files\nodejs\node_modules\npm\node_modules\npm-registry-fetch\check-response.js:104:15 19 verbose stack at processTicksAndRejections (internal/process/task_queues.js:97:5) 20 verbose statusCode 413 21 verbose pkgid canwin-viewer3d@1.0.0 22 verbose cwd C:\work\viewer3d 23 verbose Windows_NT 10.0.18363 24 verbose argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "publish" 25 verbose node v13.10.1 26 verbose npm v6.13.7 27 error code E413

it seems that the PUT Quest PayLoad was Large ,so i try to find the verdaccio config file,but i have nothing ,verdaccio it code maybe use node express to run ,how can i setting the Put Payload size?

ioy
  • 11
  • 2

1 Answers1

2

So generally you can face two problems with 413 errors.

  • Verdaccio default body size is 1 MB so you have to increase that on the client side:

npm config set max_body_size 100mb --registry https://<your registry>

  • If this does not work then you may need to increase it on the server side as the doc suggest. Add to the configuration file the following line.

values.yaml

...

  max_body_size: 100mb

....
  • If this still does not work then most likely you have a problem with your proxy.

If this is a nginx proxy you can try:

http {
    ...
    client_max_body_size 100M;
} 

or if this is a node.js server you can use the bodyParser as described in detail in this thread:

var bodyParser = require('body-parser');
app.use(bodyParser.json({limit: '50mb'}));
app.use(bodyParser.urlencoded({limit: '50mb', extended: true}));
Ivasan
  • 31
  • 2