2017-03-14 7 views
2

私はangle-cliを使ってアプリケーションを作成しています。私はSCSSに自分のスタイルを書くつもりです。そういうわけで、SCSSファイルにlintingを利用したいのです。 angle-cliを使用してアプリケーションを作成するときにNode-sassが既にインストールされていて、ローカルにsass-lintをインストールしました。npmスクリプト内でsass-lintを使用するとエラーになる

私は今、コマンドラインから首尾毛羽立ちのコマンドを実行することができます。

./node_modules/.bin/sass-lint 'src/**/*.scss' -v -q 

そして、これは私のエラーと警告のリストを提供します:私は、このCOMANDを追加するときに、しかし

src/app/app.component.scss 
    2:3 error Expected `background-color`, found `color`          property-sort-order 
    2:10 warning Color 'red' should be written in its hexadecimal form #ff0000    no-color-keywords 
    2:10 warning Color literals such as 'red' should only be used in variable declarations no-color-literals 
    3:3 error Expected `color`, found `background-color`         property-sort-order 
    3:21 warning Color 'blue' should be written in its hexadecimal form #0000ff    no-color-keywords 
    3:21 warning Color literals such as 'blue' should only be used in variable declarations no-color-literals 

package.jsonのNPMスクリプトでは、lintingの結果も表示されますが、エラーが発生します。

{ 
    ... 
    "scripts": { 
     "scsslint": "./node_modules/.bin/sass-lint 'src/**/*.scss' -v -q" 
    } 
    ... 
} 

結果出力:

0 info it worked if it ends with ok 
1 verbose cli [ '/usr/local/bin/node', 
1 verbose cli '/home/brian/.npm-packages/bin/npm', 
1 verbose cli 'run', 
1 verbose cli 'scsslint' ] 
2 info using [email protected] 
3 info using [email protected] 
4 verbose run-script [ 'prescsslint', 'scsslint', 'postscsslint' ] 
5 info lifecycle [email protected]~prescsslint: [email protected] 
6 silly lifecycle [email protected]~prescsslint: no script for prescsslint, continuing 
7 info lifecycle [email protected]~scsslint: [email protected] 
8 verbose lifecycle [email protected]~scsslint: unsafe-perm in lifecycle true 
9 verbose lifecycle [email protected]~scsslint: PATH: /home/brian/.npm-packages/lib/node_modules/npm/bin/node-gyp-bin:/home/brian/Projects/tutorials/angular2/starter/node_modules/.bin:/home/brian/.npm-packages/bin:/home/brian/bin:/home/brian/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin 
10 verbose lifecycle [email protected]~scsslint: CWD: /home/brian/Projects/tutorials/angular2/starter 
11 silly lifecycle [email protected]~scsslint: Args: [ '-c', 'sass-lint \'src/**/*.scss\' -v -q' ] 
12 silly lifecycle [email protected]~scsslint: Returned: code: 1 signal: null 
13 info lifecycle [email protected]~scsslint: Failed to exec scsslint script 
14 verbose stack Error: [email protected] scsslint: `sass-lint 'src/**/*.scss' -v -q` 
14 verbose stack Exit status 1 
14 verbose stack  at EventEmitter.<anonymous> (/home/brian/.npm-packages/lib/node_modules/npm/lib/utils/lifecycle.js:279:16) 
14 verbose stack  at emitTwo (events.js:106:13) 
14 verbose stack  at EventEmitter.emit (events.js:191:7) 
14 verbose stack  at ChildProcess.<anonymous> (/home/brian/.npm-packages/lib/node_modules/npm/lib/utils/spawn.js:40:14) 
14 verbose stack  at emitTwo (events.js:106:13) 
14 verbose stack  at ChildProcess.emit (events.js:191:7) 
14 verbose stack  at maybeClose (internal/child_process.js:877:16) 
14 verbose stack  at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5) 
15 verbose pkgid [email protected] 
16 verbose cwd /home/brian/Projects/tutorials/angular2/starter 
17 error Linux 4.4.0-64-generic 
18 error argv "/usr/local/bin/node" "/home/brian/.npm-packages/bin/npm" "run" "scsslint" 
19 error node v6.9.4 
20 error npm v4.3.0 
21 error code ELIFECYCLE 
22 error errno 1 
23 error [email protected] scsslint: `sass-lint 'src/**/*.scss' -v -q` 
23 error Exit status 1 
24 error Failed at the [email protected] scsslint script 'sass-lint 'src/**/*.scss' -v -q'. 
24 error Make sure you have the latest version of node.js and npm installed. 
24 error If you do, this is most likely a problem with the starter package, 
24 error not with npm itself. 
24 error Tell the author that this fails on your system: 
24 error  sass-lint 'src/**/*.scss' -v -q 
24 error You can get information on how to open an issue for this project with: 
24 error  npm bugs starter 
24 error Or if that isn't available, you can get their info via: 
24 error  npm owner ls starter 
24 error There is likely additional logging output above. 
25 verbose exit [ 1, true ] 

私はこのエラーを引き起こしているものを見つけるためにどのようにうまくいかないことができます。ここでは

> [email protected] scsslint /home/brian/Projects/tutorials/angular2/starter 
> sass-lint 'src/**/*.scss' -v -q 


src/app/app.component.scss 
    2:3 error Expected `background-color`, found `color`         property-sort-order 
    2:10 warning Color 'red' should be written in its hexadecimal form #ff0000    no-color-keywords 
    2:10 warning Color literals such as 'red' should only be used in variable declarations no-color-literals 
    3:3 error Expected `color`, found `background-color`         property-sort-order 
    3:21 warning Color 'blue' should be written in its hexadecimal form #0000ff    no-color-keywords 
    3:21 warning Color literals such as 'blue' should only be used in variable declarations no-color-literals 

✖ 6 problems (2 errors, 4 warnings) 


npm ERR! Linux 4.4.0-64-generic 
npm ERR! argv "/usr/local/bin/node" "/home/brian/.npm-packages/bin/npm" "run" "scsslint" 
npm ERR! node v6.9.4 
npm ERR! npm v4.3.0 
npm ERR! code ELIFECYCLE 
npm ERR! errno 1 
npm ERR! [email protected] scsslint: `sass-lint 'src/**/*.scss' -v -q` 
npm ERR! Exit status 1 
npm ERR! 
npm ERR! Failed at the [email protected] scsslint script 'sass-lint 'src/**/*.scss' -v -q'. 
npm ERR! Make sure you have the latest version of node.js and npm installed. 
npm ERR! If you do, this is most likely a problem with the starter package, 
npm ERR! not with npm itself. 
npm ERR! Tell the author that this fails on your system: 
npm ERR!  sass-lint 'src/**/*.scss' -v -q 
npm ERR! You can get information on how to open an issue for this project with: 
npm ERR!  npm bugs starter 
npm ERR! Or if that isn't available, you can get their info via: 
npm ERR!  npm owner ls starter 
npm ERR! There is likely additional logging output above. 

npm ERR! Please include the following file with any support request: 
npm ERR!  /home/brian/.npm/_logs/2017-03-14T11_52_04_406Z-debug.log 

はNPMからの結果のログ出力されます。誰かが私を正しい方向に向けることができますか?

答えて

0

このエラーは、Sass linter のエラーによってコードで取り込まれた可能性が最も高いです。

これが発生する度に、sass-lintは終了コードを1(エラー)に設定します。これはNode.js環境によって選択されます。したがって、これらのすべてのログエントリはERRです。

linterがwarningsだった場合、終了コードは0(または「成功」)になり、その問題はポップアップしません。

関連する問題