在npm以后出现以下错误:vue
$ 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
关于这个错误,网上有不少解决方法,可是都不适用在我这里。node
从错误来看, 是 /Users/lucas/code/js/vue/train/vue-sample/node_modules/follow-redirects 这个文件没有权限或者没有找到。
而后 ls 了一下这个文件, 获得以下结果:shell
$ 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 把这个东西安装上去就行了。npm
安装完成以后, 再 ls 一把this
$ 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
能够看到已经有了。debug
而后在 npm install 就没有错了。code