package.json文件裏面dev配置以下,html
"scripts": { "start": "node server.js", "dev": "DEBUG=true node server.js", "clean": "rimraf lib dist coverage", "lint": "eslint src test", "test": "NODE_ENV=test mocha --compilers js:babel-core/register --recursive", "test:watch": "NODE_ENV=test npm test -- --watch", "test:cov": "babel-node $(npm bin)/isparta cover $(npm bin)/_mocha -- --recursive", "check": "npm run lint && npm run test", "build": " ", "preversion": "npm run clean && npm run check", "version": "npm run build", "postversion": "git push && git push --tags && npm run clean", "prepublish": "npm run clean && npm run build" },
若是在window下直接跑命令會有node
debug不是內部命令。這時候要藉助cross-env包linux
"dev": "cross-env DEBUG=true node server.js",
就能夠了。git
參考:npm
npm ls --global --depth=0
修改全局安裝目錄地址,參考:json
最後在nodejs的安裝目錄中找到node_modules\npm\.npmrc文件babel
修改以下便可:post
prefix = D:\nodejs\node_global
cache = D:\nodejs\node_globalui
改完以後,命令行可能沒法啓動全局包,因此要將對應的目錄放到環境變量中去。spa