zoukankan      html  css  js  c++  java
  • npm install报错 npm ERR! enoent ENOENT: no such file or directory

    在npm之后出现如下错误:

    $ npm install
    npm WARN checkPermissions Missing write access to /Users/lucas/code/js/vue/train/vue-sample/node_modules/follow-redirects
    npm ERR! path /Users/lucas/code/js/vue/train/vue-sample/node_modules/follow-redirects
    npm ERR! code ENOENT
    npm ERR! errno -2
    npm ERR! syscall access
    npm ERR! enoent ENOENT: no such file or directory, access '/Users/lucas/code/js/vue/train/vue-sample/node_modules/follow-redirects'
    npm ERR! enoent This is related to npm not being able to find a file.
    npm ERR! enoent
    
    npm ERR! A complete log of this run can be found in:
    npm ERR!     /Users/lucas/.npm/_logs/2017-12-12T16_03_34_223Z-debug.log 
    

    关于这个错误,网上有很多解决方法,但是都不适用在我这里。

    解决方法

    从错误来看, 是 /Users/lucas/code/js/vue/train/vue-sample/node_modules/follow-redirects 这个文件没有权限或者没有找到。
    然后 ls 了一下这个文件, 得到如下结果:

    $ ls -lt | grep follow-redirects
    lrwxr-xr-x    1 lucas  staff     40 12 12 23:39 follow-redirects -> _follow-redirects@1.2.6@follow-redirects
    

    可以看到这个是一个软连接,链接到 _follow-redirects@1.2.6@follow-redirects 这个上面,很明显,在这个目录是没有follow-redirects 这个东西的。
    怎么办呢? 很简单 npm install follow-redirects 把这个东西安装上去就好了。

    安装完成之后, 再 ls 一把

    $ ls -lt | grep follow
    drwxr-xr-x   10 lucas  staff    320 12 13 00:22 _follow-redirects@1.2.6@follow-redirects
    lrwxr-xr-x    1 lucas  staff     40 12 12 23:39 follow-redirects -> _follow-redirects@1.2.6@follow-redirects
    

    可以看到已经有了。

    然后在 npm install 就没有错了。

  • 相关阅读:
    IDEA 2017 安装和破解
    Linux新增开放端口
    ping指定IP的指定端口号
    Ubuntu防火墙常用命令
    Ubuntu端口常用命令
    File Zilla连接Ubuntu 失败
    Docker常用命令详解
    Linux的vi常用命令详解
    Qt事件系统之二:鼠标事件和滚轮事件
    Qt事件系统之一:Qt中的事件处理与传递
  • 原文地址:https://www.cnblogs.com/cyttina/p/8030522.html
Copyright © 2011-2022 走看看