I have globaly installed eslint using npm : npm install -g eslint, then I setup a configuration file eslint --init by answering the questions as follow :
? How would you like to configure ESLint? Use a popular style guide
? Which style guide do you want to follow? Airbnb
? Do you use React? No
? What format do you want your config file to be in? JavaScript
I tried to run eslint on my app.js file eslint app.jsIt doesn't work
I tried to run it doing so : node_modules\.bin\eslint app.js but Ican't eslint file under \node_modules.bin
NPM Version 5.6.0
Node Version 8.10.0
Seeing the error you have just mentioned after trying:
eslint --debug app.js
You need to globally install the eslint plugin import and the eslint airbnb config plugin.
npm -g install eslint-plugin-import eslint-config-airbnb-base
You need to install said plugin because in the eslint --init configuration you have selected the Airbnb style guide.
Related
I am using npm 8.5.0 and node v16.14.2 on a big project. When I run eslint, I can choose to run it without npx, or I can run it with npx. There doesn't seem to be any difference. I'm writing some npm scripts that run eslint and I don't know whether to write npx eslint or eslint.
What is the difference between running npx eslint and eslint?
npx will download and run the package and is meant for interactive use where you just want to use a tool from the npm registry.
You shouldn't use it in your package.json's scripts section; instead just make sure the desired version of eslint is in your package's dev dependencies and use "eslint" in the scripts, so you're certain to use the correct version.
I am building API server using LoopBack 3. It is frustrating to see how it minifies JSON configuration files like package.json and other. Why does it do that and how can I disable this behaviour ?
This was not intentional, we have fixed the problem in loopback-workspace version 4.5.2 (see https://github.com/strongloop/loopback-workspace/pull/546).
Please update your loopback-cli install and its dependencies to the latest version, that should fix the problem.
For example:
npm uninstall -g loopback-cli
npm install -g loopback-cli
I had an old version of eslint:
eslint -v
v4.5.0
To update eslint I ran:
npm install -g eslint
The response said that eslint#5.9.0 had been installed successfully. Following the instructions in the documentation in my project root I ran
eslint --init
I selected the Google style guide. The install said
The style guide "google" requires eslint#>=5.4.0. You are currently using eslint#4.5.0.
Do you want to upgrade? (Y/n)
That seemed odd, as I'd just installed 5.9.0, but I said Yes. The response said that the installation was successful:
Successfully created .eslintrc.json file in /Users/TDK/LanguageTwo
ESLint was installed locally. We recommend using this local copy instead of your globally-installed copy.
Then I ran
eslint -v
v4.5.0
I checked echo $PATH and didn't see anything like eslintvm locking in an old version.
I tried to lint a file and got this error message:
Error: Cannot find module 'eslint-config-google'
eslint v5.9.0 is now installed locally in my project root and I can see eslint-config-google in the node modules. eslint 5.9.0 is installed globally. My guess is that the "missing" eslint-config-google is because my computer is still running eslint v4.5.0. I restarted my computer. What is keeping eslint at v4.5.0?
I used find . -name 'eslint' to remove every copy of eslint from every directoty. npm uninstall -g eslint didn't remove every module. Then I reinstalled eslint and ran eslint init. Now it's at v5.9.0. It still has the error
Error: Cannot find module 'eslint-config-google'
I don't know what's causing this problem.
I just installed Webpack, using:
npm install -g webpack
I then run webpack from the command line without parameters:
webpack
Each time I do this.
One CLI for webpack must be installed. These are recommended choices, delivered as separate packages:
- webpack-cli (https://github.com/webpack/webpack-cli)
The original webpack full-featured CLI.
- webpack-command (https://github.com/webpack-contrib/webpack-command)
A lightweight, opinionated webpack CLI.
We will use "npm" to install the CLI via "npm install -D".
Which one do you like to install (webpack-cli/webpack-command):
From webpack v4.0.0-alpha.1 the cli component is moved to another independant package called webpack-cli
CLI has been move to webpack-cli, you need to install webpack-cli to
use the CLI
From this github issue:
it was intentional to make webpack-cli not a dependency of webpack:
Less depenencies when only using the node.js API
Both projects can develop indiviually.
Breaking changes for webpack-cli doesn't mean breaking change for webpack and in reverse.
So, you just to install webpack-cli one time and it will work as expected.
Note: You can also install webpack-command
I had the same problem. I solved it by installing an older version of the webpack:
npm uninstall -g webpack
npm install -g webpack#3
For webpack 4 please use below command in the terminal:
npx webpack
I am pretty familiar with composer and now looking into npm, the command below doesn't seen to change the package.json file like composer require slim/slim 2.4.3
npm install express
Is changing the json manually necessary?
you should add the --save option :
npm install express --save