• 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 就没有错了。

  • 相关阅读:
    mysql__视图
    mysql__索引的设计和使用
    mysql————表类型(存储引擎)的选择
    mysql 常用函数
    mysql中的运算符
    HTML5 API详解(1):fullscreen全屏模式
    深入了解 Flexbox 伸缩盒模型
    BAT及各大互联网公司2014前端笔试面试题--Html,Css篇
    js运动动画
    原创:自定义三叉树
  • 原文地址:https://www.cnblogs.com/cyttina/p/8030522.html
Copyright © 2020-2023  润新知