Как исправить прерванное «Выполнение» задачи sass: dist «(sass)» из-за предупреждения «Аргумент« путь »должен иметь тип string». - PullRequest
0 голосов
/ 24 января 2019

Я пытаюсь настроить среду Grunt / SASS / Bootstrap для создания дизайна с помощью SASS.Когда я хочу запустить мою задачу «compile» с помощью grunt, у меня появляется эта ошибка:

aerithe77@aerithe77:~/programmation/test$ grunt compile
Running "sass:dist" (sass) task
Warning: The "path" argument must be of type string. Received type 
undefined Use --force to continue.

Aborted due to warnings.
aerithe77@aerithe77:~/programmation/test$ 
/home/aerithe77/.rvm/rubies/ruby- 
2.3.1/lib/ruby/site_ruby/2.3.0/rubygems.rb:289:in 
`find_spec_for_exe': can't find gem sass (>= 0.a) with executable 
sass (Gem::GemNotFoundException)
from /home/aerithe77/.rvm/rubies/ruby- 
2.3.1/lib/ruby/site_ruby/2.3.0/rubygems.rb:308:in 
`activate_bin_path'
from /home/aerithe77/.rvm/gems/ruby-2.3.1/bin/sass:23:in 
`<main>'
from /home/aerithe77/.rvm/gems/ruby- 
2.3.1/bin/ruby_executable_hooks:24:in `eval'
from /home/aerithe77/.rvm/gems/ruby- 
2.3.1/bin/ruby_executable_hooks:24:in `<main>'

Мой gruntfile:

module.exports = function(grunt) {

grunt.initConfig({
  pkg: grunt.file.readJSON('package.json'),
  sass: {
    dist: {
      options: {
        style: 'expanded'
      },
      files: {
        'public/css/bootstrap.css': 'node_modules/bootstrap/scss/bootstrap.scss',
        'public/css/custom.css': 'sass/custom.scss'
      }
    }
  },
      concat: {
        options: {
          separator: ';'
        },
        dist: {
          src: ['src/**/*.js'],
          dest: 'dist/<%= pkg.name %>.js'
        }
      },
      uglify: {
        options: {
          banner: '/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> */\n'
        },
        dist: {
          files: {
            'dist/<%= pkg.name %>.min.js': ['<%= concat.dist.dest %>']
          }
        }
      },
      qunit: {
        files: ['test/**/*.html']
      },
      jshint: {
        files: ['Gruntfile.js', 'src/**/*.js', 'test/**/*.js'],
        options: {
          // options here to override JSHint defaults
          globals: {
            jQuery: true,
            console: true,
            module: true,
            document: true
          }
        }
      },
      watch: {
      options: { livereload: true },
        sass: {
          files: ['public/css/custom.css', 'public/'],
          tasks: ['newer:sass:dist'],
        }
    },
      connect
      : {
    server: {
      options: {
        port: 9005,
        base: 'public',
        hostname: '*',
        livereload:true
      }
    }
  }
});

grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-connect');

grunt.registerTask('test', ['jshint', 'qunit']);
grunt.registerTask('compile', ['sass','concat', 'uglify']);
grunt.registerTask('default', ['compile','connect','watch']);
}; 

Я должен выполнить установку с помощью npm install с этим пакетом.JSON:

{
  "name": "test",
  "version": "0.1.0",
  "description": "test",
  "main": "gruntfile.js",
  "scripts": {
  "test": "echo \"Error: no test specified\" && exit 1"
 },
 "author": "Aerithe77",
 "license": "ISC",
 "devDependencies": {
 "connect-livereload": "^0.6.1",
 "grunt": "^1.0.3",
 "grunt-contrib-compass": "^1.1.1",
 "grunt-contrib-concat": "^1.0.1",
 "grunt-contrib-connect": "^2.0.0",
 "grunt-contrib-cssmin": "^3.0.0",
 "grunt-contrib-imagemin": "^3.1.0",
 "grunt-contrib-jshint": "^2.0.0",
 "grunt-contrib-nodeunit": "^2.0.0",
 "grunt-contrib-sass": "^1.0.0",
 "grunt-contrib-uglify": "^4.0.0",
 "grunt-contrib-watch": "^1.1.0"
 },
 "dependencies": {
 "bootstrap": "^4.1.3",
 "jquery": "^3.3.1",
 "popper.js": "^1.12.5"
   }
 }

Это мой первый пост, я надеюсь, что я не делаю посты Shity.Спасибо за помощь.(и извините за мой английский)

...