2013-08-04 15 views
5

nie mogę dostać grunt w ogóle pracować na Windows 7. Postępując zgodnie z instrukcjami na stronie internetowej Grunt (http://gruntjs.com/getting-started) Zabrakło mi:"Błąd krytyczny: nie można znaleźć lokalnego pomruku". Windows 7

npm uninstall -g grunt-cli 
npm uninstall grunt 
npm uninstall -g grunt-init 

git clone [email protected]:gruntjs/grunt-init-jquery.git c:/Users/me/.grunt-init/jquery 

npm install -g grunt-cli 
grunt-init jquery 
npm install . 

Po tym systemem „grunt” produkuje następujące dane wyjściowe :

grunt-cli: The grunt command line interface. (v0.1.9) 

Fatal error: Unable to find local grunt. 

If you're seeing this message, either a Gruntfile wasn't found or grunt 
hasn't been installed locally to your project. For more information about 
installing and configuring grunt, please see the Getting Started guide: 

http://gruntjs.com/getting-started 

wyjście z listy npm grunt jest:

npm WARN package.json [email protected] No repository field. 
npm WARN package.json [email protected] No repository field. 
npm WARN package.json [email protected] No repository field. 
npm WARN package.json [email protected] No repository field. 
npm WARN package.json [email protected] No repository field. 
npm WARN package.json [email protected] No repository field. 
npm WARN package.json [email protected] No repository field. 
npm WARN package.json [email protected] No repository field. 
npm WARN package.json [email protected] No repository field. 
npm WARN package.json [email protected] No repository field. 
npm WARN package.json [email protected] 'repositories' (plural) Not supported. 
npm WARN package.json Please pick one as the 'repository' field 
npm WARN package.json [email protected] No repository field. 
npm WARN package.json [email protected] No repository field. 
npm WARN package.json [email protected] No repository field. 
npm WARN package.json [email protected] No repository field. 
C:\Users\me\AppData\Roaming\npm 
└─┬ [email protected] 
    └── [email protected] 

Running "npm zainstalować chrząknięcie" w bieżącym katalogu gi ten sam błąd przy uruchomieniu pomruku.

Jakieś myśli? Rozumiem, że grunt-cli ma szukać lokalnej instalacji, ale nie mogę się domyślić, dlaczego nie może jej znaleźć.

+0

http://stackoverflow.com/questions/13925916/fatal-error-unable-to-find-local-grunt/ 13927654 # 13927654, może to pomóc. – Anshul

+0

Potrzebne jest lokalne wystąpienie pomruku. Zobacz tutaj: http: // stackoverflow.com/a/27115342/687677 – superluminary

Odpowiedz

5

Wiem, że minęły dwa lata, odkąd zadano to pytanie. Jeśli jednak ktoś chce w przyszłości:

Mam dokładnie ten sam problem. Naprawiłem to, instalując grunt lokalnie. Jak za grunt site,

Note that installing grunt-cli does not install the Grunt task runner! The job of the Grunt CLI is simple: run the version of Grunt which has been installed next to a Gruntfile. This allows multiple versions of Grunt to be installed on the same machine simultaneously.

Tak właśnie dostał pracę instalując Grunt lokalnie.

npm install grunt --save-dev 

--save: dodaje go do pliku package.json.

-dev: dodaje go jako zależność od programisty.

3

Musi być plik Gruntfile.js zlokalizowany w katalogu, z którego wykonywane jest polecenie. Sprawdź również, czy "npm install grunt" faktycznie dał ci katalog node_modules z podkatalogiem o nazwie grunt.

1

Powinieneś zainstalować grunt w trybie GUI.

Otwarte node.js cmd poprosi następnie otwórz folder główny i uruchomić poniżej poleceń

  1. npm install (raz to zrobisz możesz widzieć node_modules folder w folderze głównym)

  2. npm install –g grunt-cli (zmiana wersja z ("version": "minified" do Current release("version":"1.11"); należy zastąpić minified po uruchomieniu kompilacji)

  3. grunt build:full

Uwaga: Wersja musi się zmienić, gdy uruchomiony grunt raz pierwszy.

0

jeśli powyższa odpowiedź NIE działa to możesz spróbować za pomocą tego

rm -rf node_modules/ && npm cache clean && npm install 
Powiązane problemy