【问题标题】:grunt.js and its plugins must be installed into my project?grunt.js 及其插件必须安装到我的项目中吗?
【发布时间】:2014-01-21 08:43:52
【问题描述】:

我已阅读安装教程,该教程告诉我将 grunt.js 安装到我的 Web 项目中。 但是我想要的文件夹结构很糟糕:

1.C:\Users\MyAccount\AppData\Roaming\npm

包括grunt-cli,grunt,grunt-contrib-concat 等作为全局工具。

2.D:\Visual Studio 2012 Projects\MyWebProject

包括gruntfile.js ,html, css, js,images

无论我做什么,它都不起作用,总是找不到模块。

【问题讨论】:

  • 如果您已阅读安装设置并选择以不同的方式进行安装,您对它不起作用感到惊讶吗?有什么理由不希望在项目中本地安装这些依赖项?

标签: node.js gruntjs


【解决方案1】:

grunt-cli 已正确全局安装,但插件必须与 gruntfile 一起安装在项目中。如果您在生产中不需要它们,请将它们保存为 dev 依赖项,使用

npm install -D grunt grunt-contrib-concat

(注意:您的项目需要一个 package.json)

【讨论】:

    【解决方案2】:

    我想我已经找到了解决办法。
    在任何目录中:
    npm install -g grunt-cli
    npm install -g grunt
    npm install -g grunt-contrib-concat
    npm install -g grunt-contrib-uglify
    切换到您的项目目录
    npm 链接咕噜声
    npm 链接 grunt-contrib-concat
    npm 链接 grunt-contrib-uglify
    咕噜声默认分钟

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-10-11
      • 2020-10-18
      • 1970-01-01
      • 2015-03-21
      • 1970-01-01
      相关资源
      最近更新 更多