今天抽空將個人靜態服務 ks-server 以前留下的 bug(在node低版本狀況下報錯)維護了一下。node
當我從新 npm link
時,以下錯誤:git
npm WARN ks-server@1.0.2 No repository field. npm ERR! Darwin 17.5.0 npm ERR! argv "/Users/zhuqiang/.nvm/versions/node/v6.4.0/bin/node" "/Users/zhuqiang/.nvm/versions/node/v6.4.0/bin/npm" "link" npm ERR! node v6.4.0 npm ERR! npm v3.10.3 npm ERR! path /Users/zhuqiang/.nvm/versions/node/v6.4.0/bin/ks-server npm ERR! code EEXIST npm ERR! Refusing to delete /Users/zhuqiang/.nvm/versions/node/v6.4.0/bin/ks-server: ../lib/node_modules/ks-server/bin/www.js symlink target is not controlled by npm /Users/zhuqiang/github/ks-server npm ERR! File exists: /Users/zhuqiang/.nvm/versions/node/v6.4.0/bin/ks-server npm ERR! Move it away, and try again. npm ERR! Please include the following file with any support request: npm ERR! /Users/zhuqiang/github/ks-server/npm-debug.log
我注意到,bug 日誌中有:github
npm ERR! File exists: /Users/zhuqiang/.nvm/versions/node/v6.4.0/bin/ks-server npm ERR! Move it away, and try again.
忽然意識到, 闊能是以前已經生成了一個 ks-server 這樣一個 link,當我修改 package.json 中的 bin 時,使其與當前的 ks-server 命令對不上。而報錯,且日誌中的 Move it away, and try again
也有次意思。npm
因而,(解決方法):json
cd /Users/zhuqiang/.nvm/versions/node/v6.4.0/bin rm -rf ks-server
而後回到項目目錄,從新 npm link
就 bingo 了。bash
前路漫漫,當克己,當慎獨。debug