【问题标题】:grunt js not working in windows咕噜声js在Windows中不起作用
【发布时间】:2014-03-30 14:33:53
【问题描述】:

我是第一次在 windows 上使用 grunt 并使用 grunt 0.3 版本。 我安装了 nodejs、npm,然后使用 ->

安装了 grunt 0.3
 npm install -g grunt@0.3.0 --save-dev

在 windows 中尝试 grunt build 时出现错误 Microsoft jquery 运行时错误,需要对象。

然后我发现在 Windows 中grunt build 不起作用,所以我使用了grunt.cmd。 它看起来更好,因为我没有得到 jquery 异常,但现在我得到以下错误并且仍然无法构建 -

path.existsSync is now called `fs.existsSync`.
>> Npm module "grunt-css" not found. Is it installed?
>> Npm module "grunt-jasmine-runner" not found. Is it installed?
>> Npm module "grunt-contrib-copy" not found. Is it installed?
>> Npm module "grunt-dustjs" not found. Is it installed?
>> Npm module "grunt-contrib-less" not found. Is it installed?

Running "docs:dist" (docs) task
python ./libs/atnotate/atnotate.py -s ./src/ -d ./docs/ -t ./libs/atnotate/templates
<WARN> Task "dustjs" not found. Use --force to continue. </WARN>

Aborted due to warnings.

非常感谢您提供的任何帮助。

谢谢

在凯文的解决方案之后更新,我有所有文件但仍然找不到 grunt-css -

 ls -l /usr/local/lib/node_modules/

drwxr-xr-x  14 nobody  wheel  476 Feb 28 15:02 grunt
drwxr-xr-x  14 nobody  staff  476 Feb 28 14:37 grunt-contrib-copy
drwxr-xr-x  14 nobody  staff  476 Feb 28 14:38 grunt-contrib-less
drwxr-xr-x  11 nobody  wheel  374 Feb 28 15:19 grunt-css
drwxr-xr-x  10 nobody  wheel  340 Feb 28 15:18 grunt-dustjs
drwxr-xr-x  17 nobody  staff  578 Feb 28 14:38 grunt-jasmine-runner
drwxr-xr-x  21 24561   staff  714 Feb 28 14:04 npm

# grunt build
path.existsSync is now called `fs.existsSync`.
  >> Npm module "grunt-css" not found. Is it installed?
   <WARN> Task "cssmin" not found. Use --force to continue. </WARN>

  Aborted due to warnings.

【问题讨论】:

    标签: windows node.js gruntjs npm


    【解决方案1】:

    该错误表明您的 Gruntfile.js 可能正在引用该项目中尚未安装的 grunt 模块。

    如果这些依赖是在package.json中定义的,你应该只需要npm install

    如果它们没有在 package.json 中定义,您可能需要手动安装这些模块并将它们保存到您的开发依赖项中。

    npm install --save-dev grunt-css grunt-jasmine-runner grunt-contrib-copy grunt-dustjs grunt-contrib-less
    

    【讨论】:

    • 谢谢凯文。但是对于 grunt-css,我仍然会收到此错误。你能帮忙吗?已更新。
    • 这很奇怪。值得注意的一点是,大多数依赖项都有“staff”组,而 grunt-css 和 grunt-dustjs 有“wheel”组。
    • 我也尝试过让它成为员工,但它仍然不起作用。还有其他指针吗?
    • 我注意到下一行写着Task "cssmin" -- 可能是npm install grunt-contrib-cssmin
    • 我卸载了 node / npm / grunt 并进行了重新安装,这次使用 brew 安装并且成功了。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-01-05
    • 2013-10-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多