首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >grunt-exec在运行hexo时出现问题

grunt-exec在运行hexo时出现问题
EN

Stack Overflow用户
提问于 2019-08-07 22:49:33
回答 1查看 53关注 0票数 0

我正在为我的网站使用grunt.js构建脚本。基本的站点结构是

代码语言:javascript
复制
www/
    homepage_and_other_stuff/
    hexo_blog/
        hexo_stuff/
        package.json
        node_modules/
    node_modules/
    Gruntfile.js
    package.json

我正在使用grunt exec来清理和生成我的Hexo站点。相关代码如下:

代码语言:javascript
复制
module.exports = function(grunt) {

    // Project config
    grunt.initConfig({
        pkg: grunt.file.readJSON("package.json"),

        // CLEAN and GENERATE the blog portion of the site
        exec: {
            cd_blog: "cd blog",
            clean_blog: "hexo clean",
            generate_blog: "hexo generate",
            go_back: "cd ../"
        }
    });

    // Tasks
    grunt.loadNpmTasks("grunt-exec");

    // Build
    grunt.registerTask("build", "Builds site for production", function() {
        grunt.log.writeln("Building site..."["blue"]);
        grunt.task.run("exec");
    });


};

但是,当通过grunt-exec运行'hexo clean‘时,我得到了响应:

代码语言:javascript
复制
Usage: hexo <command>
Commands: 
  help     Get help on a command. 
  init     Create a new Hexo folder.
  version  Display version information.
Global Options:
  --config  Specify config file instead of using _config.yml
  --cwd     Specify the CWD
  --debug   Display all verbose messages in the terminal
  --draft   Display draft posts
  --safe    Disable all plugins and scripts
  --silent  Hide output on console
For more help, you can use 'hexo help [command]' for the detailed information
or you can check the docs: http://hexo.io/docs/

因为它认为我没有在我的Hexo命令中添加cleangenerate参数。

我认为Hexo安装在/blog/的node_modules中,而不是Grunt的node_modules安装在根目录中,这是有问题的,然而,我在根目录中尝试了npm install hexo --save-dev,但在运行grunt-build时仍然得到相同的错误

EN

回答 1

Stack Overflow用户

发布于 2019-08-08 02:19:07

我最终使用了grunt-hexo。我认为Grunt只是与多个package.json之类的东西发生了冲突。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/57397107

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档