<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Npm on Shellj的博客</title>
    <link>https://im.shellj.com/tags/npm/</link>
    <description>Recent content in Npm on Shellj的博客</description>
    <generator>Hugo</generator>
    <language>en</language>
    <lastBuildDate>Mon, 19 Feb 2024 01:48:00 +0800</lastBuildDate>
    <atom:link href="https://im.shellj.com/tags/npm/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>wsl npm install EACCES: permission denied 错误解决方法</title>
      <link>https://im.shellj.com/posts/2020/05/wsl-npm-install-permission-denied-error/</link>
      <pubDate>Mon, 18 May 2020 20:39:00 +0800</pubDate>
      <guid>https://im.shellj.com/posts/2020/05/wsl-npm-install-permission-denied-error/</guid>
      <description>&lt;h2 id=&#34;问题&#34;&gt;问题&lt;/h2&gt;&#xA;&lt;p&gt;在 WSL 里使用 &lt;code&gt;npm install&lt;/code&gt; 安装包的时候出现如下的权限错误：&lt;/p&gt;&#xA;&#xA;&lt;div class=&#34;code-block&#34;&gt;&#xA;  &#xA;  &lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;root@pi ~# npm install -g npm&#xA;npm ERR! code EACCES&#xA;npm ERR! syscall rename&#xA;npm ERR! path /usr/lib/node_modules/.staging/npm-18aca6f9/node_modules/yargs&#xA;npm ERR! dest /usr/lib/node_modules/.staging/yargs-765698bc&#xA;npm ERR! errno -13&#xA;npm ERR! Error: EACCES: permission denied, rename &amp;#39;/usr/lib/node_modules/.staging/npm-18aca6f9/node_modules/yargs&amp;#39; -&amp;gt; &amp;#39;/usr/lib/node_modules/.staging/yargs-765698bc&amp;#39;&#xA;npm ERR!  [OperationalError: EACCES: permission denied, rename &amp;#39;/usr/lib/node_modules/.staging/npm-18aca6f9/node_modules/yargs&amp;#39; -&amp;gt; &amp;#39;/usr/lib/node_modules/.staging/yargs-765698bc&amp;#39;] {&#xA;npm ERR!   cause: [Error: EACCES: permission denied, rename &amp;#39;/usr/lib/node_modules/.staging/npm-18aca6f9/node_modules/yargs&amp;#39; -&amp;gt; &amp;#39;/usr/lib/node_modules/.staging/yargs-765698bc&amp;#39;] {&#xA;npm ERR!     errno: -13,&#xA;npm ERR!     code: &amp;#39;EACCES&amp;#39;,&#xA;npm ERR!     syscall: &amp;#39;rename&amp;#39;,&#xA;npm ERR!     path: &amp;#39;/usr/lib/node_modules/.staging/npm-18aca6f9/node_modules/yargs&amp;#39;,&#xA;npm ERR!     dest: &amp;#39;/usr/lib/node_modules/.staging/yargs-765698bc&amp;#39;&#xA;npm ERR!   },&#xA;npm ERR!   errno: -13,&#xA;npm ERR!   code: &amp;#39;EACCES&amp;#39;,&#xA;npm ERR!   syscall: &amp;#39;rename&amp;#39;,&#xA;npm ERR!   path: &amp;#39;/usr/lib/node_modules/.staging/npm-18aca6f9/node_modules/yargs&amp;#39;,&#xA;npm ERR!   dest: &amp;#39;/usr/lib/node_modules/.staging/yargs-765698bc&amp;#39;&#xA;npm ERR! }&#xA;npm ERR!&#xA;npm ERR! The operation was rejected by your operating system.&#xA;npm ERR! It is likely you do not have the permissions to access this file as the current user&#xA;npm ERR!&#xA;npm ERR! If you believe this might be a permissions issue, please double-check the&#xA;npm ERR! permissions of the file and its containing directories, or try running&#xA;npm ERR! the command again as root/Administrator.&#xA;&#xA;npm ERR! A complete log of this run can be found in:&#xA;npm ERR!     /root/.npm/_logs/2020-05-18T14_52_40_128Z-debug.log&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;/div&gt;&#xA;&lt;p&gt;我已经是 root 用户了，文件夹的权限也没什么问题，所以这个错误很是费解，查询了一大圈后，最终解决了问题，这里记录一下可能出现的解决方法。&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
