grunt-copy-deps不会复制依赖项

时间:2018-01-10 10:53:58

标签: javascript npm gruntjs

Gruntfile.js

module.exports = function (grunt) {
// Project configuration.
grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    copydeps: {
        target: {
            options: {
                unminified: true,
                css: true
            },
            pkg: 'package.json',
            dest: 'src/main/webapp/libs/'
        }
    }
});

grunt.loadNpmTasks('grunt-copy-deps');


// Default task(s).
grunt.registerTask('default', ['copydeps']);
};

我期望(作为一个总菜鸟)将它从package.json中提到的node_modules作为非开发依赖项复制到我的webapp目录。这是package.json

{
  "name": "coll-app",
  "version": "1.0.0",
  "keywords": [
    "util",
    "functional",
    "server",
    "client",
    "browser"
  ],
  "author": "fedd",
  "contributors": [],
  "dependencies": {
    "bpmn-js": "0.26.3"
  },
  "optionalDependencies": {},
  "devDependencies": {
    "grunt-contrib-nodeunit": "1.0.0",
    "grunt": "1.0.1",
    "grunt-copy-deps": "1.2.2"
  }
}

webapp/libs/不会出现,也不会复制文件。这是从命令行运行时的咕噜咕噜声:

# grunt -v
Initializing
Command-line options: --verbose

Reading "Gruntfile.js" Gruntfile...OK

Registering Gruntfile tasks.
Reading package.json...OK
Parsing package.json...OK
Initializing config...OK

Registering "grunt-copy-deps" local Npm module tasks.
Reading /home/fedd/Documents/Work/NetBeansProjects/coll/node_modules/grunt-copy-deps/package.json...OK
Parsing /home/fedd/Documents/Work/NetBeansProjects/coll/node_modules/grunt-copy-deps/package.json...OK
Loading "copydeps.js" tasks...OK
+ copydeps
Loading "Gruntfile.js" tasks...OK
+ default

No tasks specified, running default tasks.
Running tasks: default

Running "default" task

Running "copydeps" task

Running "copydeps:target" (copydeps) task
Verifying property copydeps.target exists in config...OK
Files: -> src/main/webapp/libs/
Options: minified, unminified, js, css, ignore=[], exclude={"css":[],"js":[]}, include={"css":{},"js":{}}
Reading /home/fedd/Documents/Work/NetBeansProjects/coll/package.json...OK
Parsing /home/fedd/Documents/Work/NetBeansProjects/coll/package.json...OK

Done.

发生了什么以及为什么不复制任何内容?

我也从Netbeans 8.2运行它,没有运气。其他版本:

# nodejs --version
v8.9.4
# npm --version
5.6.0
# grunt --version
grunt-cli v1.2.0
# ubuntu --version
ubuntu: command not found

实际上,17.10。谢谢!

0 个答案:

没有答案