➜ eslinta git:(master) ✗ npm install eslint --save-dev
eslinta@1.0.0 /Users/next/es6/jsmodules/eslinta
└─┬ eslint@3.15.0
├─┬ babel-code-frame@6.22.0
│ └── js-tokens@3.0.1
├─┬ chalk@1.1.3
│ ├── ansi-styles@2.2.1
...
npm WARN eslinta@1.0.0 No description
npm WARN eslinta@1.0.0 No repository field.
➜ eslinta git:(master) ✗ eslint -v
zsh: command not found: eslint
➜ eslinta git:(master) ✗
What's the reason of this problem? I installed node by nvm.
Command line modules are installed in a project at ./node_modules/.bin
so you can run eslint directly with ./node_modules/.bin/eslint
. The better approach is to create a script entry in your package.json:
"scripts": {
"lint": "eslint"
}
because running commands from the scripts
entry in package.json
will automatically add ./node_modules/.bin
to the path. This way you can run your lint with npm run lint
您是否尝试过在全球范围内安装eslint?
npm install -G eslint eslinta@1.0.0
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.