Node.js   发布时间:2022-04-24  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了gruntjs – grunt致命错误:无法在Yeoman找到本地咕噜声大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我安装yeoman并启动了官方文档中提供的示例。
我经历了建议的操作

yo webapp 
    bower install underscore  
    grunt

运行grunt后,我有消息

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

注意,grunt已经安装

npm install -g grunt-cli

npm install -g grunt

yo已经在项目根目录中生成了Gruntfile.js,我正在运行命令。
package.json也已经生成

"name": "testyo","version": "0.0.0","dependencies": {},"devDependencies": {
      "grunt": "~0.4.1","grunt-contrib-copy": "~0.4.1","grunt-contrib-concat": "~0.1.3","grunt-contrib-coffee": "~0.6.5","grunt-contrib-uglify": "~0.2.0","grunt-contrib-compass": "~0.2.0","grunt-contrib-jshint": "~0.4.1","grunt-contrib-cssmin": "~0.6.0","grunt-contrib-connect": "~0.2.0","grunt-contrib-clean": "~0.4.0","grunt-contrib-htmlmin": "~0.1.3","grunt-contrib-imagemin": "~0.1.3","grunt-contrib-watch": "~0.4.0","grunt-rev": "~0.1.0","grunt-autoprefixer": "~0.1.20130516","grunt-usemin": "~0.1.10","grunt-mocha": "~0.3.0","grunt-open": "~0.2.0","grunt-svgmin": "~0.1.0","grunt-concurrent": "~0.1.0","matchdep": "~0.1.1","connect-livereload": "~0.2.0"
    },"@R_262_10846@nes": {
      "node": ">=0.8.0"
    }

另外。从根目录

grunt --version
    grunt-cli v0.1.9

这确认了grunt可以在每个目录中运行。
任何想法?

解决方法

经过一些快速的研究,我意识到,从 grunt documentation,咕噜必须安装在项目中。我通过运行:

sudo npm install grunt --save-dev

现在咕噜作品。

我还需要运行:

npm install

便加载所有依赖项。

解决了我的问题。老实说,我认为yeoman会自动照顾最后两个步骤。

如果你有意见或认为有一个更好的解决方案,请留下评论

大佬总结

以上是大佬教程为你收集整理的gruntjs – grunt致命错误:无法在Yeoman找到本地咕噜声全部内容,希望文章能够帮你解决gruntjs – grunt致命错误:无法在Yeoman找到本地咕噜声所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。