Home>

This part is the main error part, but is it because lint:css is wrong?
Applicable articleI did not understand the meaning of the error well. ..

npm ERR! errno 2
npm ERR! [email protected] lint:css: `stylelint ./src/scss/**/*.scss`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the [email protected] lint:css script.
npm ERR! This is probably not a problem with npm.There is likely additional logging output above.

.stylelintrc.json↓

{
  "extends": "stylelint-config-recommended-scss"
}

package.json↓

{
  "name": "gulptest",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\"&&exit 1",
    "lint:css": "stylelint ./src/scss/**/*.scss"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "browser-sync": "^2.26.7",
    "gulp": "^4.0.2",
    "gulp-autoprefixer": "^7.0.1",
    "gulp-cssbeautify": "^2.0.1",
    "gulp-html-beautify": "^1.0.1",
    "gulp-notify": "^3.2.0",
    "gulp-plumber": "^1.2.1",
    "gulp-pug": "^4.0.1",
    "gulp-sass": "^4.1.0",
    "gulp-sass-glob": "^1.1.0",
    "gulp-stylelint": "^13.0.0",
    "gulp-uglify": "^3.0.2",
    "stylelint": "^13.6.1",
    "stylelint-config-recess-order": "^2.0.4",
    "stylelint-config-recommended": "^3.0.0",
    "stylelint-config-recommended-scss": "^4.2.0",
    "stylelint-config-standard": "^20.0.0",
    "stylelint-scss": "^3.18.0"
  },
  "browserslist": [
    "last 2 versions",
    "Explorer 11",
    "iOS 9.0",
    "Android 4.1"
  ]
}

The full npm code is below.
Thanks for your cooperation.

fuhixx-2:gulptest-beautify fuhixx$npm run lint:css
>[email protected] lint:css /Users/fuhixx/gulp success save file /gulptest-beautify
>stylelint ./src/scss/**/*.scss

src/scss/foundation/_reset.scss
 151:1 ✖ Expected selector "ul" to come before no-descending-specificity
           selector "nav ul"
 162:1 ✖ Unexpected duplicate selector "a", first no-duplicate-selectors
           used at line 60
 179:1 ✖ Unexpected duplicate selector "table", no-duplicate-selectors
           first used at line 92
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] lint:css: `stylelint ./src/scss/**/*.scss`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the [email protected] lint:css script.
npm ERR! This is probably not a problem with npm.There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/fuhixx/.npm/_logs/2020-06-29T22_08_39_289Z-debug.log
fuhixx-2:gulptest-beautify fuhixx$
  • Answer # 1

    I think that it is the same as the following page.

    An error occurs when a lint command is caught in a check, but since it is not a problem in processing just by returning it as a check error, add the -s (—silent) option to npm scripts. Try not to output the error log on the npm side.

  • Answer # 2

    This part is the main error part, but is it because lint:css is wrong?

    The lint:css script does its part to do the CSS (actually SCSS) check successfully, display the check result, and then the exit code (indicating that the check was caught) 2 Ended with.
    npm displayed an error log indicating that the script returned a non-zero exit code (indicating a normal end).

    It is that. The measures are as shown by others.