在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