Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/419.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript grunt bower任务是从bower_组件中删除coffeescript,然后抱怨它';她失踪了_Javascript_Node.js_Coffeescript_Gruntjs_Bower - Fatal编程技术网

Javascript grunt bower任务是从bower_组件中删除coffeescript,然后抱怨它';她失踪了

Javascript grunt bower任务是从bower_组件中删除coffeescript,然后抱怨它';她失踪了,javascript,node.js,coffeescript,gruntjs,bower,Javascript,Node.js,Coffeescript,Gruntjs,Bower,当我运行grunt-bower-v时,我得到以下输出: Initializing Command-line options: --verbose Reading "Gruntfile.js" Gruntfile...OK Registering Gruntfile tasks. Registering "grunt-bower-task" local Npm module tasks. Reading /Users/zen/ducks/are/cool/node_modules/grunt

当我运行
grunt-bower-v
时,我得到以下输出:

Initializing
Command-line options: --verbose

Reading "Gruntfile.js" Gruntfile...OK

Registering Gruntfile tasks.

Registering "grunt-bower-task" local Npm module tasks.
Reading /Users/zen/ducks/are/cool/node_modules/grunt-bower-task/package.json...OK
Parsing /Users/zen/ducks/are/cool/node_modules/grunt-bower-task/package.json...OK
Loading "bower_task.js" tasks...OK
+ bower

Registering "thorax-inspector" local Npm module tasks.
Reading /Users/zen/ducks/are/cool/node_modules/thorax-inspector/package.json...OK
Parsing /Users/zen/ducks/are/cool/node_modules/thorax-inspector/package.json...OK
Loading "thorax-inspector.js" tasks...OK
+ thorax:inspector

Registering "tasks" tasks.
Loading "ensure-installed.js" tasks...OK
+ ensure-installed
Loading "styles.js" tasks...OK
+ styles

Registering "grunt-exec" local Npm module tasks.
Reading /Users/zen/ducks/are/cool/node_modules/grunt-exec/package.json...OK
Parsing /Users/zen/ducks/are/cool/node_modules/grunt-exec/package.json...OK
Loading "exec.js" tasks...OK
+ exec
Reading /Users/zen/ducks/are/cool/package.json...OK
Parsing /Users/zen/ducks/are/cool/package.json...OK

Registering "grunt-contrib-copy" local Npm module tasks.
Reading /Users/zen/ducks/are/cool/node_modules/grunt-contrib-copy/package.json...OK
Parsing /Users/zen/ducks/are/cool/node_modules/grunt-contrib-copy/package.json...OK
Loading "copy.js" tasks...OK
+ copy

Registering "grunt-contrib-concat" local Npm module tasks.
Reading /Users/zen/ducks/are/cool/node_modules/grunt-contrib-concat/package.json...OK
Parsing /Users/zen/ducks/are/cool/node_modules/grunt-contrib-concat/package.json...OK
Loading "concat.js" tasks...OK
+ concat

Registering "grunt-contrib-cssmin" local Npm module tasks.
Reading /Users/zen/ducks/are/cool/node_modules/grunt-contrib-cssmin/package.json...OK
Parsing /Users/zen/ducks/are/cool/node_modules/grunt-contrib-cssmin/package.json...OK
Loading "cssmin.js" tasks...OK
+ cssmin

Registering "grunt-contrib-watch" local Npm module tasks.
Reading /Users/zen/ducks/are/cool/node_modules/grunt-contrib-watch/package.json...OK
Parsing /Users/zen/ducks/are/cool/node_modules/grunt-contrib-watch/package.json...OK
Loading "watch.js" tasks...OK
+ watch

Registering "grunt-contrib-jshint" local Npm module tasks.
Reading /Users/zen/ducks/are/cool/node_modules/grunt-contrib-jshint/package.json...OK
Parsing /Users/zen/ducks/are/cool/node_modules/grunt-contrib-jshint/package.json...OK
Loading "jshint.js" tasks...OK
+ jshint

Registering "grunt-contrib-connect" local Npm module tasks.
Reading /Users/zen/ducks/are/cool/node_modules/grunt-contrib-connect/package.json...OK
Parsing /Users/zen/ducks/are/cool/node_modules/grunt-contrib-connect/package.json...OK
Loading "connect.js" tasks...OK
+ connect

Registering "grunt-contrib-less" local Npm module tasks.
Reading /Users/zen/ducks/are/cool/node_modules/grunt-contrib-less/package.json...OK
Parsing /Users/zen/ducks/are/cool/node_modules/grunt-contrib-less/package.json...OK
Loading "less.js" tasks...OK
+ less

Registering "grunt-bower-task" local Npm module tasks.
Reading /Users/zen/ducks/are/cool/node_modules/grunt-bower-task/package.json...OK
Parsing /Users/zen/ducks/are/cool/node_modules/grunt-bower-task/package.json...OK
Loading "bower_task.js" tasks...OK
+ bower

Registering "grunt-exec" local Npm module tasks.
Reading /Users/zen/ducks/are/cool/node_modules/grunt-exec/package.json...OK
Parsing /Users/zen/ducks/are/cool/node_modules/grunt-exec/package.json...OK
Loading "exec.js" tasks...OK
+ exec

Registering "grunt-contrib-clean" local Npm module tasks.
Reading /Users/zen/ducks/are/cool/node_modules/grunt-contrib-clean/package.json...OK
Parsing /Users/zen/ducks/are/cool/node_modules/grunt-contrib-clean/package.json...OK
Loading "clean.js" tasks...OK
+ clean

Registering "grunt-contrib-requirejs" local Npm module tasks.
Reading /Users/zen/ducks/are/cool/node_modules/grunt-contrib-requirejs/package.json...OK
Parsing /Users/zen/ducks/are/cool/node_modules/grunt-contrib-requirejs/package.json...OK
Loading "requirejs.js" tasks...OK
+ requirejs
Initializing config...OK
Loading "Gruntfile.js" tasks...OK
+ autotest, build, default, production, styles:development

Running tasks: bower

Running "bower" task

Running "bower:install" (bower) task
Verifying property bower.install exists in config...OK
File: [no files]
Options: cleanTargetDir=false, cleanBowerDir=false, targetDir="./bower_components", layout="byComponent", install, verbose=false, copy, bowerOptions={}
>> Installed bower packages
Reading /Users/zen/ducks/are/cool/bower.json...OK
Parsing /Users/zen/ducks/are/cool/bower.json...OK
Reading bower_components/almond/almond.js...OK
Writing bower_components/almond/almond.js...OK
grunt-bower copying bower_components/almond/almond.js -> bower_components/almond/almond.js
Reading bower_components/backbone/backbone.js...OK
Writing bower_components/backbone/backbone.js...OK
grunt-bower copying bower_components/backbone/backbone.js -> bower_components/backbone/backbone.js
Reading bower_components/bootstrap/less/bootstrap.less...OK
Writing bower_components/bootstrap/bootstrap.less...OK
grunt-bower copying bower_components/bootstrap/less/bootstrap.less -> bower_components/bootstrap/bootstrap.less
Reading bower_components/bootstrap/dist/css/bootstrap.css...OK
Writing bower_components/bootstrap/bootstrap.css...OK
grunt-bower copying bower_components/bootstrap/dist/css/bootstrap.css -> bower_components/bootstrap/bootstrap.css
Reading bower_components/bootstrap/dist/js/bootstrap.js...OK
Writing bower_components/bootstrap/bootstrap.js...OK
grunt-bower copying bower_components/bootstrap/dist/js/bootstrap.js -> bower_components/bootstrap/bootstrap.js
Reading bower_components/bootstrap/dist/fonts/glyphicons-halflings-regular.eot...OK
Writing bower_components/bootstrap/glyphicons-halflings-regular.eot...OK
grunt-bower copying bower_components/bootstrap/dist/fonts/glyphicons-halflings-regular.eot -> bower_components/bootstrap/glyphicons-halflings-regular.eot
Reading bower_components/bootstrap/dist/fonts/glyphicons-halflings-regular.svg...OK
Writing bower_components/bootstrap/glyphicons-halflings-regular.svg...OK
grunt-bower copying bower_components/bootstrap/dist/fonts/glyphicons-halflings-regular.svg -> bower_components/bootstrap/glyphicons-halflings-regular.svg
Reading bower_components/bootstrap/dist/fonts/glyphicons-halflings-regular.ttf...OK
Writing bower_components/bootstrap/glyphicons-halflings-regular.ttf...OK
grunt-bower copying bower_components/bootstrap/dist/fonts/glyphicons-halflings-regular.ttf -> bower_components/bootstrap/glyphicons-halflings-regular.ttf
Reading bower_components/bootstrap/dist/fonts/glyphicons-halflings-regular.woff...OK
Writing bower_components/bootstrap/glyphicons-halflings-regular.woff...OK
grunt-bower copying bower_components/bootstrap/dist/fonts/glyphicons-halflings-regular.woff -> bower_components/bootstrap/glyphicons-halflings-regular.woff
Reading bower_components/chai/chai.js...OK
Writing bower_components/chai/chai.js...OK
grunt-bower copying bower_components/chai/chai.js -> bower_components/chai/chai.js
Fatal error: ENOENT, no such file or directory 'bower_components/coffeescript'
在我看来,它在抱怨咖啡脚本丢失了。我已尝试清理我的bower缓存,并从
bower\u组件中删除所有内容。我正在使用的
grunt-bower任务
的版本是
0.4.0
(在撰写本文时最新版本)

有趣的是,如果我运行
bowerinstall
它会很好地安装coffeescript,这就是它的结束(重新运行命令不会安装任何东西)。以下是输出:

bower coffeescript#~1.7.1       cached git://github.com/jashkenas/coffeescript.git#1.7.1
bower coffeescript#~1.7.1     validate 1.7.1 against git://github.com/jashkenas/coffeescript.git#~1.7.1
bower coffeescript#~1.7.1      install coffeescript#1.7.1

coffeescript#1.7.1 bower_components/coffeescript
这是我的
bower.json

{
  "name": "t3-web",
  "version": "0.0.0",
  "dependencies": {
    "requirejs": "~2.1",
    "thorax": "2.2.1",
    "underscore": "1.5.0",
    "handlebars": "1.0.0",
    "backbone": "1.1.1",
    "almond": "~0.2.6",
    "fixtures": "~1.3.1",
    "mocha": "1.x",
    "chai": "1.x",
    "sinon": "http://sinonjs.org/releases/sinon-1.7.3.js",
    "sinon-chai": "2.x",
    "text": "requirejs/text#~2.0.12",
    "requirejs-hbs": "trombom/requirejs-hbs#v0.1",
    "require-cs": "~0.5.0",
    "jquery": "1.9.0",
    "bootstrap": "3.x"
  }
}

任何建议都将不胜感激,我已经为此挣扎了好几天了…

看起来问题在于grunt bower任务的默认值 “复制”选项为true:

选项。复制

类型:布尔值默认值:true

将Bower包复制到目标目录

任务尝试复制包,源目录和目标目录都是“/bower\u组件”,这可能是导致失败的原因。
我还没有弄清楚复制失败的coffeescript有什么独特之处,以及它与其他软件包有何不同。

通过将复制选项设置为false,我能够解决错误:

options: {
    targetDir: "./bower_components",
    copy: false
}

运行grunt bower时,您的项目目录中是否有“bower\u components/coffeescript”?我以前有过,但grunt bower任务似乎会将其删除(在检查是否存在之前,然后抱怨)该死,您是个救生员!