我用以下命令卸载了grunt.
npm uninstall -g grunt
Run Code Online (Sandbox Code Playgroud)
然后我再次使用以下命令安装grunt.
npm install -g grunt-cli
Run Code Online (Sandbox Code Playgroud)
请访问以下链接:https: //npmjs.org/package/grunt-html
我想使用上面的grunt插件
但是当我运行grunt命令时,它会给我以下错误:
D:\nodeJS\node_modules\grunt-html>grunt
grunt-cli: The grunt command line interface. (v0.1.6)
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
Run Code Online (Sandbox Code Playgroud)
asg*_*oth 174
所有这些都在gruntjs.com上得到了很好的解释.
请注意,安装grunt-cli不会安装grunt任务运行器!grunt CLI的工作很简单:运行已经安装在Gruntfile旁边的grunt版本.这允许多个版本的grunt同时安装在同一台机器上.
所以在你的项目文件夹中,你需要安装(最好)最新的grunt版本:
npm install grunt --save-dev
Run Code Online (Sandbox Code Playgroud)
选项--save-dev将grunt作为dev-dependency添加到package.json中.这样可以轻松地重新安装依赖项.
Don*_*Yoo 20
您必须在项目文件夹中安装grunt
创建你的package.json
$ npm init
Run Code Online (Sandbox Code Playgroud)为这个项目安装grunt,这将安装在node_modules/.--save-dev会将此模块添加到package.json中的devDependency
$ npm install grunt --save-dev
Run Code Online (Sandbox Code Playgroud)然后创建gruntfile.js并运行
$ grunt
Run Code Online (Sandbox Code Playgroud)| 归档时间: |
|
| 查看次数: |
115103 次 |
| 最近记录: |