【问题标题】:grunt "Error: Cannot find module '../time/convert' (only on windows)grunt “错误:找不到模块 '../time/convert'(仅在 Windows 上)
【发布时间】:2013-11-22 01:17:54
【问题描述】:

在 linux 下建立一个新的 Angular 项目。将其提交给 git 并将其克隆到 windows。使用 bower 和 npm,我设法加载了所有内容,除了我有这个错误(仅在 Windows 上)

项目中 ../time/convert 的递归 grep 显示:

./node_modules/grunt-contrib-imagemin/node_modules/gifsicle/node_modules/bin-wrapper/node_modules/mout/date/diff.js:var convert = require('../time/convert');
./node_modules/grunt-contrib-imagemin/node_modules/gifsicle/node_modules/bin-wrapper/node_modules/mout/src/date/diff.js:define(['./totalDaysInMonth', './totalDaysInYear', '../time/convert'], function(totalDaysInMonth, totalDaysInYear, convert){
./node_modules/grunt-contrib-imagemin/node_modules/optipng-bin/node_modules/bin-wrapper/node_modules/mout/date/diff.js:var convert = require('../time/convert');
./node_modules/grunt-contrib-imagemin/node_modules/pngquant-bin/node_modules/bin-wrapper/node_modules/mout/date/diff.js:var convert = require('../time/convert');
./node_modules/grunt-contrib-imagemin/node_modules/pngquant-bin/node_modules/bin-wrapper/node_modules/mout/src/date/diff.js:define(['./totalDaysInMonth', './totalDaysInYear', '../time/conve

但 ls -l 显示:

$ ls ./node_modules/grunt-contrib-imagemin/node_modules/gifsicle/node_modules/bin-wrapper/node_modules/mout/time
convert.js  now.js  parseMs.js  toTimeString.js

这说明 convert.js 确实存在。作为 grunt 和 Angular 的新手,我很困惑这可能来自哪里以及如何解决它。

在这之后我最终被困在这里:

Running "karma:unit" (karma) task
INFO [karma]: Karma v0.10.4 server started at http://localhost:8080/
INFO [launcher]: Starting browser Chrome
WARN [watcher]: Pattern ".../test/mock/**/*.js" does not match any file
WARN [launcher]: Chrome have not captured in 60000 ms, killing.
INFO [launcher]: Trying to start Chrome again.
WARN [launcher]: Chrome have not captured in 60000 ms, killing.
INFO [launcher]: Trying to start Chrome again.

想知道在 Windows 上是否无法使用 grunt 进行角度工作......

【问题讨论】:

  • 我猜,mout 库假设 *nix 路径。您可以尝试编辑这些行以使用 path.normalize 例如var path = require('path'); var convert = require(path.normalize('../time/convert'));我还没有真正使用过它,所以我不能保证它会起作用,但这是我尝试的第一件事
  • 看来我弄错了,没必要,stackoverflow.com/questions/9756567/…
  • 在我的情况下,尝试安装 bower 时会出现同样的错误;然而,没有时间/文件夹在它应该在的地方。只有一个time.js 文件包含//automatically generated, do not edit! run `node build` instead 并且需要调用./time/etcpp。但仍然:没有这样的文件夹,只有在 src 目录中......有什么想法吗?
  • meh...bower update mout 解决了这个问题。

标签: windows node.js npm gruntjs


【解决方案1】:

我的解决方案是退出使用 Windows。将开发工作转移到 linux,不再出现类似的疯狂问题。哦,我的机器现在看起来也快了很多。

【讨论】:

    猜你喜欢
    • 2015-03-07
    • 2016-04-30
    • 2015-04-07
    • 1970-01-01
    • 2013-12-20
    • 1970-01-01
    • 1970-01-01
    • 2014-11-18
    • 2014-10-06
    相关资源
    最近更新 更多