Uploaded image for project: 'Artifactory Binary Repository'
  1. Artifactory Binary Repository
  2. RTFACT-12323

NPM search is not working since there is a limitation within NPM of 256mb for the ability to parse String



    • Type: Bug
    • Status: Resolved
    • Priority: High
    • Resolution: Fixed
    • Affects Version/s: 4.11.2
    • Fix Version/s: 4.12.2
    • Component/s: NPM
    • Labels:


      We are saving the .npm/all.json as pretty json. Since NPM client can do toString only for files that are around 250+- mb (256) then the search fails with NPM error to parse the String:

      npm verb request uri http://localhost:9090/artifactory/api/npm/npm-remote/-/all
      npm verb request always-auth set; sending authorization
      npm info attempt registry request try #1 at 11:54:20 PM
      npm verb request id de189ee4c2f99094
      npm http request GET http://localhost:9090/artifactory/api/npm/npm-remote/-/all
      npm http 200 http://localhost:9090/artifactory/api/npm/npm-remote/-/all
      npm verb stack Error: toString failed
      npm verb stack  at Buffer.toString (buffer.js:379:11)
      npm verb stack  at CachingRegistryClient.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:193:19)
      npm verb stack  at Request._callback (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:172:14)
      npm verb stack  at Request.self.callback (/usr/local/lib/node_modules/npm/node_modules/request/request.js:199:22)
      npm verb stack  at emitTwo (events.js:87:13)
      npm verb stack  at Request.emit (events.js:172:7)
      npm verb stack  at Request.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/request/request.js:1036:10)
      npm verb stack  at emitOne (events.js:82:20)
      npm verb stack  at Request.emit (events.js:169:7)
      npm verb stack  at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/request/request.js:963:12)

      When you run npm search and the .npm/all.json file is bigger then 256mb then the NPM fails. Currently if you search against npm registry the file is around 184+- mb. However, in Artifactory it's being stored as pretty JSON. The extra lines adds to the size and therefore the size of the all.json is around 264+-mb. In this case the search fails. The same occurs against local repository. If the all.json file that is being created is bigger the required then the search fails with the same error. This is a limitation on NPM side that we need to workaround it for now until a solution can be provided by NPM




            shayb Shay Bagants
            alexeiv Alexei Vainshtein
            1 Vote for this issue
            3 Start watching this issue