1
votes

I am trying to publish scoped npm packages to artifactory and I get the following error:

npm ERR! registry error parsing json
npm ERR! publish Failed PUT 404
npm ERR! Darwin 15.4.0
npm ERR! argv "/usr/local/Cellar/node4-lts/4.6.2/bin/node" "/usr/local/bin/npm" "publish"
npm ERR! node v4.6.2
npm ERR! npm  v2.15.9

npm ERR! Unexpected token <
npm ERR! <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
npm ERR! <html><head>
npm ERR! <title>404 Not Found</title>
npm ERR! </head><body>
npm ERR! <h1>Not Found</h1>
npm ERR! <p>The requested URL /artifactory/api/npm/npm-local/@acres/acresmetajs was not found on this server.</p>
npm ERR! <hr>
npm ERR! <address>Apache/2.2.31 (Amazon) Server at artifacts.company.com Port 80</address>
npm ERR! </body></html>

I have set up my .npmrc file the following way:

registry=http://artifacts.company.com/artifactory/api/npm/npm-local/
_auth="mypassword"
always-auth=true
[email protected]
@acres:registry=http://artifacts.company.com/artifactory/api/npm/npm-local/
//artifacts.company.com/artifactory/api/npm/npm-local/:_password=mypassword
//artifacts.company.com/artifactory/api/npm/npm-local/:username=myusername
//artifacts.company.com/artifactory/api/npm/npm-local/:[email protected]
//artifacts.company.com/artifactory/api/npm/npm-local/:always-auth=true

I run npm publish and npm publish --registry http://artifacts.company.com/artifactory/api/npm/npm-local/ and get this same error. What am I missing?

2
I get the same exception. - Daniel
Daniel I just added an answer that worked for me. If you are behind maven that might be your problem. I got a lot of help from github.com/npm/npm/issues. I would try that too. - fractalflame
i have the same problem. npm ERR! code E404 npm ERR! 404 Not Found - PUT npm.pkg.github.com/xxxxx npm ERR! 404 npm ERR! 404 'xxxxx' is not in the npm registry. npm ERR! 404 You should bug the author to publish it (or use the name yourself!) npm ERR! 404 npm ERR! 404 Note that you can also install from a npm ERR! 404 tarball, folder, http url, or git url. i have npm version : 6.13.4 and in package.json i don't have "engines" group. - raq

2 Answers

1
votes

I've found there are a couple more steps for getting scoped packages to work with artifactory if it's behind maven. https://techblog.dorogin.com/setting-up-artifactory-as-npm-repository-behind-apache-7541d5140492#.z0q412z5j

Essentially:

  • AllowEncodedSlashed set to NoDecode (by default it’s Off)
  • Added keyword nocanon for ProxyPass, it tells mod_proxy module not to canonicalize URLs
0
votes

I got this on version 6.5.0. And the solution was remove "engines" group from in package.json.

npm ERR! publish Failed PUT 404
npm ERR! code E404
npm ERR! 404 NotFound The package 'xxxxxxxx' was not found in feed 'npmjs': xxxxxxxx
npm ERR! 404
npm ERR! 404  'xxxxxxxx' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.