Среда: Linux 2.6.32-573.12.1.el6.x86_64 x86_64, через SSH
У меня немного нестандартная настройка для моего ворчания, как описано ниже:
/home/scoots/public_html/
grunt/
package.json
node_modules/
project1/
Gruntfile.js
project2/
Gruntfile.js
project1/
project2/
Когда я запускаю grunt watch и вносю изменения в мой Gruntfile.js (что не является обычным явлением, но все же может произойти что-то, что может произойти в зависимости от потребностей проекта), я получаю следующую ошибку:
$ cd ~/public_html/grunt/project1
$ grunt watch
Running "watch" task
Waiting...
Reloading watch config...
Fatal error: EACCES: permission denied, scandir '/home'
С этим достаточно просто иметь дело (просто отмените и перезапустите grunt) - но это требует, чтобы я заметил.Иногда я могу попытаться продолжить работу, но grunt watch теперь будет заблокирован.
Кроме того, раздражает то, что этот код используется, когда я установил grunt на локальную (Windows) машину и запустил ее.из командной строки Node.js.
Для справки, вот пример Gruntfile.js, который демонстрирует эту проблему:
module.exports = function(grunt) {
require('time-grunt')(grunt);
require('jit-grunt')(grunt);
grunt.file.setBase('../');
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
site_dir: {
site: '../tcl/wp-content/themes/twentysixteen-child',
jscache: 'wp-content/themes/twentysixteen-child/js/src',
grunt: 'tcl'
},
watch: {
css: {
files: ['<%= site_dir.site %>/css/sass/*.scss'],
tasks: ['sass', 'postcss'],
options: {
spawn: false
}
},
scripts: {
files: ['<%= site_dir.site %>/js/src/*.js'],
tasks: ['include_file', 'uglify'],
options: {
spawn: false
}
},
configFiles: {
files: ['<%= site_dir.grunt %>/Gruntfile.js'],
options: {
reload: true
}
}
},
sass: {
options: {
style: 'expanded', // compressed in postcss
sourcemap: true,
sourceMapEmbed: true,
precision: 8,
includePaths: ['node_modules/bootstrap-sass/assets/stylesheets']
},
dist: {
files: {
'<%= site_dir.grunt %>/css/layout.css': '<%= site_dir.site %>/css/sass/layout.scss'
}
}
},
postcss: {
options: {
map: {
inline: false,
annotation: '<%= site_dir.grunt %>/css/maps/'
},
processors: [
require('autoprefixer')({
browsers: [
"Android 2.3",
"Android >= 4",
"Chrome >= 20",
"Firefox >= 24",
"Explorer >= 8",
"iOS >= 6",
"Opera >= 12",
"Safari >= 6"
]
}),
require('csswring')()
]
},
dist: {
src: '<%= site_dir.grunt %>/css/layout.css',
dest: '<%= site_dir.site %>/css/layout.min.css'
}
},
include_file: {
js: {
cwd: '<%= site_dir.grunt %>/',
src: [
'../<%= site_dir.site %>/js/src/common.js'
],
dest: '<%= site_dir.grunt %>/js/'
}
},
uglify: {
options: {
compress: {
warnings: true
},
mangle: true,
preserveComments: /(?:^!|@(?:license|preserve|cc_on))/
},
build: {
src: [
'<%= site_dir.grunt %>/<%= site_dir.jscache %>/common.js'
],
dest: '<%= site_dir.site %>/js/common.min.js'
}
}
});
grunt.registerTask('default', ['sass', 'postcss', 'include_file', 'uglify']);
};
И package.json:
{
"name": "Test",
"version": "0.1.0",
"dependencies": {
"bootstrap-sass": "3.3.7"
},
"devDependencies": {
"autoprefixer": "^6.4.1",
"csswring": "^5.1.0",
"grunt": "^1.0.1",
"grunt-contrib-uglify": "^2.0.0",
"grunt-contrib-watch": "^1.0.0",
"grunt-include-file": "^0.1.3",
"grunt-postcss": "^0.8.0",
"grunt-sass": "^2.0.0",
"jit-grunt": "^0.10.0",
"time-grunt": "^1.4.0"
}
}
РЕДАКТИРОВАТЬ: включен подробный / отладка:
$ grunt -v -d watch
Initializing
Command-line options: --verbose, --debug=1
Reading "Gruntfile.js" Gruntfile...OK
Registering Gruntfile tasks.
Reading package.json...OK
Parsing package.json...OK
Initializing config...OK
Loading "Gruntfile.js" tasks...OK
+ default
Running tasks: watch
Loading "grunt-contrib-watch" plugin
Registering "/home/scoots/public_html/grunt/node_modules/grunt-contrib-watch/tasks" tasks.
Loading "watch.js" tasks...OK
+ watch
Running "watch" task
[D] Task source: /home/scoots/public_html/grunt/node_modules/grunt-contrib-watch/tasks/watch.js
Waiting...
Verifying property watch exists in config...OK
Verifying property watch.css.files exists in config...OK
Verifying property watch.scripts.files exists in config...OK
Verifying property watch.config.files exists in config...OK
Watching ../tcl/wp-content/themes/twentysixteen-child/css/sass/__bookings.scss for changes.
Watching ../tcl/wp-content/themes/twentysixteen-child/css/sass/__variables.scss for changes.
Watching ../tcl/wp-content/themes/twentysixteen-child/css/sass/_bootstrap-custom.scss for changes.
Watching ../tcl/wp-content/themes/twentysixteen-child/css/sass/_contactform7.scss for changes.
Watching ../tcl/wp-content/themes/twentysixteen-child/css/sass/_lightslider.scss for changes.
Watching ../tcl/wp-content/themes/twentysixteen-child/css/sass/_lity.scss for changes.
Watching ../tcl/wp-content/themes/twentysixteen-child/css/sass/_zoom.scss for changes.
Watching ../tcl/wp-content/themes/twentysixteen-child/css/sass/layout.scss for changes.
Watching ../tcl/wp-content/themes/twentysixteen-child/js/src/bootstrap.js for changes.
Watching ../tcl/wp-content/themes/twentysixteen-child/js/src/common.js for changes.
Watching ../tcl/wp-content/themes/twentysixteen-child/js/src/instafeed.js for changes.
Watching ../tcl/wp-content/themes/twentysixteen-child/js/src/lightslider.js for changes.
Watching ../tcl/wp-content/themes/twentysixteen-child/js/src/lity.js for changes.
Watching ../tcl/wp-content/themes/twentysixteen-child/js/src/scrollreveal.min.js for changes.
Watching ../tcl/wp-content/themes/twentysixteen-child/js/src/zoom.js for changes.
Watching tcl/Gruntfile.js for changes.
Watching tcl/css for changes.
Watching tcl/js for changes.
Watching tcl/wp-content for changes.
Clearing require cache for "tcl/Gruntfile.js" file...OK
[[[[I edit the Gruntfile here]]]]
Reloading watch config...
Fatal error: EACCES: permission denied, scandir '/home'