{"id":4689,"date":"2016-07-13T20:59:37","date_gmt":"2016-07-13T20:59:37","guid":{"rendered":"http:\/\/www.garysieling.com\/blog\/?p=4689"},"modified":"2016-07-13T20:59:37","modified_gmt":"2016-07-13T20:59:37","slug":"fixing-error-npm-login-nexus-server-store-operations-valid-package-roots","status":"publish","type":"post","link":"https:\/\/www.garysieling.com\/blog\/fixing-error-npm-login-nexus-server-store-operations-valid-package-roots\/","title":{"rendered":"Fixing error on npm login against a Nexus server: &#8220;Store operations are only valid for package roots&#8221;"},"content":{"rendered":"<p>If you try to authenticate against a Nexus server for NPM, you can get some strange errors.<\/p>\n<p>Here is how I tried logging in:<\/p>\n<pre lang=\"bash\">\nnpm login\nUsername: gsieling\nPassword:\nEmail: (this IS public) gary@garysieling.com\n<\/pre>\n<p>And this is what I get:<\/p>\n<pre lang=\"xml\">\nnpm ERR! registry error parsing json\nnpm ERR! Windows_NT 6.1.7601\nnpm ERR! argv \"c:\\\\Program Files (x86)\\\\nodejs\\\\node.exe\" \"c:\\\\Program Files (x86)\\\\nodejs\\\\node_modules\\\\npm\\\\bin\\\\npm-cli.js\" \"login\"\nnpm ERR! node v4.3.1\nnpm ERR! npm  v2.14.12\n\nnpm ERR! Unexpected token <\nnpm ERR! <html>\nnpm ERR!   <head>\nnpm ERR!     <title>400 - Store operations are only valid for package roots, path: \/-\/user\/org.couchdb.user:gsieling<\/title>\nnpm ERR!     <meta http-equiv=\"Content-Type\" content=\"text\/html; charset=utf-8\"\/>\nnpm ERR!\nnpm ERR!     <link rel=\"icon\" type=\"image\/png\" href=\"http:\/\/garysieling.com:8081\/nexus\/favicon.png\">\nnpm ERR!     <!--[if IE]>\nnpm ERR!     <link rel=\"SHORTCUT ICON\" href=\"http:\/\/garysieling.com:8081\/nexus\/favicon.ico\"\/>\nnpm ERR!     <![endif]-->\nnpm ERR!\nnpm ERR!     <link rel=\"stylesheet\" href=\"http:\/\/garysieling.com:8081\/nexus\/static\/css\/Sonatype-content.css?2.11.2-04\" type=\"text\/css\" media=\"screen\" title=\n\"no title\" charset=\"utf-8\">\nnpm ERR!   <\/head>\nnpm ERR!   <body>\nnpm ERR!     <h1>400 - Store operations are only valid for package roots, path: \/-\/user\/org.couchdb.user:gsieling<\/h1>\nnpm ERR!     <p>Store operations are only valid for package roots, path: \/-\/user\/org.couchdb.user:gsieling<\/p>\nnpm ERR!   <\/body>\nnpm ERR! <\/html>\nnpm ERR!\nnpm ERR!\nnpm ERR! If you need help, you may report this error at:\nnpm ERR!     <https:\/\/github.com\/npm\/npm\/issues>\n\nnpm ERR! Please include the following file with any support request:\nnpm ERR!     e:\\Projects\\npm-debug.log\n<\/pre>\n<p>The recommended way to fix this is apparently to bypass authentication entirely, by setting up your .npmrc correctly. To find out where this is, type:<\/p>\n<pre lang=\"bash\">\nnpm config list\n<\/pre>\n<p>And the location will be visible.<\/p>\n<p>From here, you can add lines to the file like so:<\/p>\n<pre lang=\"bash\">\ninit.author.name = Gary Sieling\ninit.author.email = gary@garysieling.com\ninit.author.url = https:\/\/www.garysieling.com\nemail=gsieling@wingspan.com\nalways-auth=true\n_auth=YWRtaW46YWRtaW4xMjM=\n<\/pre>\n<p>Note that both email addresses are required<sup><a href=\"#footnote_0_4689\" id=\"identifier_0_4689\" class=\"footnote-link footnote-identifier-link\" title=\"https:\/\/issues.sonatype.org\/browse\/NEXUS-7976\">1<\/a><\/sup>. The &#8220;_auth&#8221; param is admin:admin123 (a Nexus default). If you want to use something else, the nexus documentation<sup><a href=\"#footnote_1_4689\" id=\"identifier_1_4689\" class=\"footnote-link footnote-identifier-link\" title=\"https:\/\/books.sonatype.com\/nexus-book\/reference\/npm-deploying-packages.html\">2<\/a><\/sup> recommends this:<\/p>\n<pre lang=\"bash\">\necho -n 'admin:admin123' | openssl base64\n<\/pre>\n<ol class=\"footnotes\"><li id=\"footnote_0_4689\" class=\"footnote\">https:\/\/issues.sonatype.org\/browse\/NEXUS-7976<span class=\"footnote-back-link-wrapper\"> [<a href=\"#identifier_0_4689\" class=\"footnote-link footnote-back-link\">&#8617;<\/a>]<\/span><\/li><li id=\"footnote_1_4689\" class=\"footnote\">https:\/\/books.sonatype.com\/nexus-book\/reference\/npm-deploying-packages.html<span class=\"footnote-back-link-wrapper\"> [<a href=\"#identifier_1_4689\" class=\"footnote-link footnote-back-link\">&#8617;<\/a>]<\/span><\/li><\/ol>","protected":false},"excerpt":{"rendered":"<p>Fixing authentication errors in Nexus<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[9],"tags":[362,382,393],"aioseo_notices":[],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/4689"}],"collection":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/comments?post=4689"}],"version-history":[{"count":0,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/4689\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/media?parent=4689"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/categories?post=4689"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/tags?post=4689"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}