2013-05-31 4 views
5

dopiero się rozpoczął z pomrukiem, a kiedy biegnę grunt otrzymuję ten błądGrunt nie jest zdefiniowana

Loading "Gruntfile.js" tasks...ERROR 
>> ReferenceError: grunt is not defined 

To mój Gruntfile.js

module.exports = function(grunt){ 
    'use strict'; 
}; 

Odpowiedz

5

Nie do końca wiem, dlaczego, ale to rozwiązane ten problem:

'use strict'; 
module.exports = function(grunt){ 
}; 
+0

prostu miał ten sam błąd, jak ty, ale używając ścisłej współpracy mmand nie rozwiązuje tego dla mnie. – Jorre

0

Ja też widziałem wiele komunikatów o błędach "nie zdefiniowano" na moim terminalu.

Znalazłem inny plik gruntfile.js z tego samego katalogu, w którym miałem zainstalowany Node i NPM, i zastąpiłem bojler gruntfile.js innym plikiem gruntfile.js.

Teraz nazywam Gruntem i działa.

7

miałem nagle się ze mną,

'use strict'; 
module.exports = function(grunt) { 
    grunt.initConfig({ 
    sass: { 
     dist: { 
     files: { 
      'style.css': 'style.scss' 
     }, 
     options: { 
      includePaths: ['css/'], 
      outputStyle: 'nested' 
     } 
     } 
    }, 
    }); 
    grunt.loadNpmTasks('grunt-sass'); 
    grunt.registerTask('sass', ['sass']); 

}; 

Upewnij się loadNpmTasks i polecenia registerTask są wewnątrz module.export, jeśli są poza zakresem tego zamknięcia grunt nie zostanie określony , więc to się nie udało

0

Miałem przecinki końcowe w moim pliku gruntfile kodu, który rzucił ten błąd. Dziękuję ReSharper. Mam nadzieję, że to pomaga komuś.

pkg: grunt.file.readJSON('package.json'), 
    ngAnnotate: { 
     options: { 
      singleQuotes: true 
     }, 
     FFApp: { 
      files: { 
       'Scripts/Angular-Annotated/Annotated.js': ['Scripts/Angular/**/*js'] 
      } 

(< usunięte to)

 } 

(< i ten jeden)

},