【问题标题】:Cannot find module '@tridnguyen/config' | Install npm grunt找不到模块'@tridnguyen/config' |安装 npm grunt
【发布时间】:2017-08-16 02:46:09
【问题描述】:

安装 npm 后运行 grunt 时出错。

C:\Users\XXXX\git\projectname\cartridges>grunt
Loading "Gruntfile.js" tasks...ERROR
>> Error: Cannot find module '@tridnguyen/config'
Warning: Task "default" not found. Use --force to continue.

Aborted due to warnings.

【问题讨论】:

    标签: node.js git npm gruntjs


    【解决方案1】:

    此错误来自您的系统中未安装 git 或 PATH 中未设置 git。

    预期的根本原因和解决方案:

    如果未安装,请从https://git-scm.com/download/win 下载 git

    如果已安装但未在路径中设置,则在 PATH 中设置以下 git 地址。

    ;C:\Program Files\Git\bin;C:\Program Files\Git\cmd
    

    关闭后重新打开运行命令提示符,然后再次运行命令。 npm install --save @tridnguyen/config

    这个时间命令应该执行成功了。

    也请访问:http://www.clearfunda.com/ 以查找更多知识渊博的东西。

    【讨论】:

      【解决方案2】:

      很难说,因为您没有向我们展示您的 package.jsonGruntfile.js

      但正如错误所说,未找到模块 @tridnguyen/config
      所以你应该从安装依赖项开始:

      npm install
      

      或者,如果这是一个新项目:

      npm install --save @tridnguyen/config
      

      还有一个 grunt 警告,因为您的 Gruntfile.js 文件中没有注册的默认任务。

      如果您想使用grunt 命令,您可能需要添加一个:

      grunt.registerTask('default', ["your_default_task"]);
      

      您还应该查看Grunt documentation 以更加熟悉它。

      【讨论】:

        猜你喜欢
        • 2018-09-05
        • 2014-11-18
        • 2013-11-23
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-09-17
        • 1970-01-01
        • 2018-03-29
        相关资源
        最近更新 更多