2

I have a private package published to the GitHub package registry. I now want to deprecate it. I tried running this..

npm deprecate --verbose @test-engineering/test-roles "This package has been deprecated and superseded by @test-engineering/test-r - github.com/test-engineering/test-common/blob/master/packages/test"

and got this error..

npm info it worked if it ends with ok
npm verb cli [
npm verb cli   '/tests/**/.nvm/versions/node/v12.20.1/bin/node',
npm verb cli   '/tests/**/.nvm/versions/node/v12.20.1/bin/npm',
npm verb cli   'deprecate',
npm verb cli   '--verbose',
npm verb cli   '@test-engineering/test-roles',
npm verb cli   'This package has been deprecated and superseded by @test-engineering/test - github.com/test-engineering/test-common/blob/master/packages/test'
npm verb cli ]
npm info using npm@6.14.10
npm info using node@v12.20.1
npm verb npm-session da92d8e02740777e
npm http fetch GET 200 npm.pkg.github.com/test-engineering/@test-engineering%2ftest-roles?write=true 277ms
npm http fetch PUT 400 npm.pkg.github.com/test-engineering/@test-engineering%2ftest-roles 269ms
npm verb stack Error: 400 Bad Request - PUT npm.pkg.github.com/test-engineering/@test-engineering%2ftest-roles - failed to stream package from json: unhandled input: No new versions found in package.json
npm verb stack     at /tests/**/.nvm/versions/node/v12.20.1/lib/node_modules/npm/node_modules/npm-registry-fetch/check-response.js:117:15
npm verb stack     at processTicksAndRejections (internal/process/task_queues.js:97:5)
npm verb statusCode 400
npm verb pkgid @test-engineering/test-roles@latest
npm verb cwd /tests/**/repos/test-common
npm verb Darwin 20.2.0
npm verb argv "/tests/**/.nvm/versions/node/v12.20.1/bin/node" "/tests/**/.nvm/versions/node/v12.20.1/bin/npm" "deprecate" "--verbose" "@test-engineering/test-roles" "This package has been deprecated and superseded by @test-engineering/test - https://github.com/test-engineering/test-common/blob/master/packages/test"
npm verb node v12.20.1
npm verb npm  v6.14.10
npm ERR! code E400
npm ERR! 400 Bad Request - PUT npm.pkg.github.com/test-engineering/@test-engineering%2ftest-roles - failed to stream package from json: unhandled input: No new versions found in package.json
npm verb exit [ 1, true ]
npm timing npm Completed in 824ms

npm ERR! A complete log of this run can be found in:
npm ERR!     /tests/**/.npm/_logs/2021-03-31T06_11_49_149Z-debug.log

I wonder if its a scoped modules issue. Does anyone have any ideas as to what could be going on? I saw this question, but it looks like a different error than mine.

Edit 1

Some observations after setting up publishConfig correctly --

  • I still end up with this error:
npm ERR! 
code E400 npm ERR! 400 Bad Request - PUT https://npm.pkg.github.com/test-engineering/@test-engineering%2ftest-roles - failed to stream package from json: unhandled input: No new versions found in package.json..
  • Does it matter if repository#url is ssh instead of https? This is also a monorepo, so the repository field looks like this.. I wonder if this is also causing a problem.
{ 
  "type": "git", 
  "url": "ssh://git@github.com:test-engineering/test-common.git", 
  "directory": "packages/test-roles"
  }
  • Does it matter where I run the deprecate command from? Should I be in the package directory?
krishwader
  • 11,341
  • 1
  • 34
  • 51

1 Answers1

0

Try to Specify the publishConfig option in package.json if you have not already set it up or look that it is set up right:

"publishConfig": {
    "registry":"https://npm.pkg.github.com/OWNER"
},

replace OWNER with the name of your user account on GitHub where you did publish the package.

Example in package.json:

{
  "name": "@Owner/repository",
  "repository": {
    "type": "git",
    "url": "https://github.com/Owner/repository"
  },
  "publishConfig": {
    "registry": "https://npm.pkg.github.com/Owner"
  }
}

The Owner, repository/url and the publishConfig/registry must match. repository is where you have your package. Hope this was of any help.

Filip Huhta
  • 2,043
  • 7
  • 25