我使用Grunt作为"JS任务运行程序“。
节点安装在"C:/Program“中。
NPM安装在C:/users/Peterson/appdata/漫游/npm中。
Grunt,Bower,和Grunt在npm文件夹中。
创建一个项目-D:/项目A。
D:/ProjectA - "package.json"和gruntfile.js中的以下文件
package.json
{
"name": "Test-Project",
"version": "0.1.0",
"devDependencies": {
"grunt": "~0.4.1",
"grunt-contrib-concat": "~0.1.3"
}
}gruntfile.js
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
//Read the package.json (optional)
pkg: grunt.file.readJSON('package.json'),
// Metadata.
meta: {
basePath: '../',
srcPath: '../src/',
deployPath: '../deploy/'
},
banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd") %>\n' +
'* Copyright (c) <%= grunt.template.today("yyyy") %> ',
// Task configuration.
concat: {
options: {
stripBanners: true
},
dist: {
src: ['<%= meta.srcPath %>scripts/fileone.js', '<%= meta.srcPath %>scripts/filetwo.js'],
dest: '<%= meta.deployPath %>scripts/app.js'
}
}
});
// These plugins provide necessary tasks.
grunt.loadNpmTasks('grunt-contrib-concat');
// Default task
grunt.registerTask('default', ['concat']);
};在CLI D:/ProjectA> grunt中
Fatal Error: Unable to find local grunt有人能帮忙吗?
发布于 2015-10-14 10:11:55
您已经安装了节点/npm和Grunt & Bower的clis (我假设通过npm install -g全局安装它们)
您所缺少的是在项目根目录下运行npm install ( package.json文件所在的地方),安装在package.json中指定的项目依赖项
https://stackoverflow.com/questions/33121259
复制相似问题