grunt錯誤——Fatal error: Unable to find Gruntfile,gruntgruntfile
E:\website\jquery-plugins>gruntA valid Gruntfile could not be found. Please see the getting started guide formore information on how to configure grunt: http://gruntjs.com/getting-startedFatal error: Unable to find Gruntfile.
錯誤提示Gruntfile.js檔案找不到,但項目中已經有Gruntfile.js檔案,後來發現是用npm安裝grunt模組時,沒有安裝完整(可能是中途中斷了安裝,但grunt模組的目錄已經存在與node_modules目錄下),解決辦法是重新安裝grunt模組:
E:\website\jquery-plugins>npm install grunt
再次執行:
E:\website\jquery-plugins> gruntLoading "uglify.js" tasks...ERROR>> Error: ENOENT, no such file or directory 'E:\website\jquery-plugins\node_modules\grunt-contrib-uglify\node_modules\uglify-js\lib\utils.src'Warning: Task "uglify" not found. Use --force to continue.Aborted due to warnings.
錯誤提示沒有這個檔案或者目錄,猜測grunt的uglify外掛程式也沒有安裝完整,重新安裝:
E:\website\jquery-plugins>npm install grunt-contrib-uglify --save-dev
執行grunt的預設tasks(我這裡的預設tasks只有uglify)
E:\website\jquery-plugins>gruntRunning "uglify:build" (uglify) task>> 1 file created.Done, without errors.