<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: nazhenhuiyi</title>
    <description>The latest articles on DEV Community by nazhenhuiyi (@zilinrrr).</description>
    <link>https://dev.to/zilinrrr</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F894204%2F976b528f-7ce3-405b-a03f-aee0302de885.jpeg</url>
      <title>DEV Community: nazhenhuiyi</title>
      <link>https://dev.to/zilinrrr</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/zilinrrr"/>
    <language>en</language>
    <item>
      <title>publlish a private npm package by using github packages</title>
      <dc:creator>nazhenhuiyi</dc:creator>
      <pubDate>Tue, 19 Jul 2022 06:02:14 +0000</pubDate>
      <link>https://dev.to/zilinrrr/publlish-a-private-npm-package-by-using-github-packages-1gf5</link>
      <guid>https://dev.to/zilinrrr/publlish-a-private-npm-package-by-using-github-packages-1gf5</guid>
      <description>&lt;h2&gt;
  
  
  BACKGROUND
&lt;/h2&gt;

&lt;p&gt;Sometimes we need publish NPM package for reusing code, and we don’t want stranger to access our package，so we need publish a private npm package.&lt;/p&gt;

&lt;h2&gt;
  
  
  HOW TO PUBLISH
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Create &lt;code&gt;Your Personal Acess Token&lt;/code&gt; in &lt;a href="https://github.com/settings/tokens"&gt;github&lt;/a&gt;, plz select &lt;code&gt;write packages and delete packages permission&lt;/code&gt;.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7YxwlQ21--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c8pmtqmxuaq9ea71fpxy.png" alt="Image description" width="880" height="497"&gt;
&lt;/li&gt;
&lt;li&gt;Login in github registry in your terminal, plz &lt;code&gt;run npm login --scope=@OWNER --registry=https://npm.pkg.github.com&lt;/code&gt;.If this package is in your team, scope is your team's name.&lt;/li&gt;
&lt;li&gt;create a .npmrc file in your root dir, and add a line &lt;code&gt;@OWNER:registry=https://npm.pkg.github.com&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;modify package.json file&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Verify the name of your package in your project's&amp;nbsp;package.json. The&amp;nbsp;name&amp;nbsp;field must contain the scope and the name of the package. For example, if your package is called "test", and you are publishing to the "My-org" GitHub organization, the&amp;nbsp;name&amp;nbsp;field in your&amp;nbsp;package.json&amp;nbsp;should be&amp;nbsp;@my-org/test.&lt;/li&gt;
&lt;li&gt;Verify the&amp;nbsp;repository&amp;nbsp;field in your project's&amp;nbsp;package.json. The&amp;nbsp;repository&amp;nbsp;field must match the URL for your GitHub repository. For example, if your repository URL is&amp;nbsp;github.com/my-org/test&amp;nbsp;then the repository field should be&amp;nbsp;&lt;code&gt;git://github.com/my-org/test.git&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Verify the&amp;nbsp;files&amp;nbsp;field in your project's&amp;nbsp;package.json. You should include files that should be published.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;publish package by running npm publish.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--kQI5XJrp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d7bsye9knrmedrvvevu1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--kQI5XJrp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d7bsye9knrmedrvvevu1.png" alt="Image description" width="880" height="466"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  How To Install
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;You should follow HOW TO PUBLISH , and complete 1st step , 2nd step and 3rd step. &lt;/li&gt;
&lt;li&gt;run &lt;code&gt;npm install @OWNER/your-components&lt;/code&gt; or &lt;code&gt;yarn add @OWNER/your-components&lt;/code&gt;. &lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>npm</category>
      <category>github</category>
      <category>javascript</category>
      <category>node</category>
    </item>
  </channel>
</rss>
