npm安装不安装+找不到grunt-contrib.copy
我有两个问题。 我正在完成“学习到程序”一书中的一个项目,对于为什么npm没有安装,以及为什么我收到另一个错误消息,我有点困惑。 我正在使用Windows,我已经安装了node.js(v0.12.2)并尝试安装grunt: npm install -g grunt-cli
问题1 – 当我尝试安装npm时,它没有列出package.json中定义的所有依赖项。
以下显示当我尝试在我的主目录中安装npm:
C:\Users\Me\My Documents\kittenbook\npm install npm WARN package.json kittenbook@0.0.1 No description npm WARN package.json kittenbook@0.0.1 No repository field npm WARN package.json kittenbook@0.0.1 No README data
从我看到的情况来看,应该在这三个警告之后显示一连串的行,比如:
npm http GET https://registry.npmjs.org/grunt-contrib-concat npm http GET https://registry.npmjs.org/grunt npm http GET https://registry.npmjs.org/grunt-contrib-copy
等等。
问题2:这可能是因为安装npm工作不正常,但是当我尝试运行“grunt jshint”时,它给了我这个错误:
>> Local Npm module "grunt-contrib-.copy" not found. Is it installed? Running "jshint:files" (jshint) task >> 2 files lint free Done, without errors.
对不起,这是一个非常有组织的问题,但是我对编程非常陌生,对于问题出在哪里,我感到非常困惑。
这里是一些更多的信息。
Gruntfile.js
module.exports = function(grunt) { // Project configuration grunt.initConfig({ concat: { release: { src: ['js/values.js', 'js/prompt.js'], dest: 'release/main.js' } }, copy: { release: { src: 'manifest.json', dest: 'release/manifest.json' } }, jshint: { files: ['js/values.js', 'js/prompt.js'] } }); // Load Grunt plugins grunt.loadNpmTasks('grunt-contrib-concat'); grunt.loadNpmTasks('grunt-contrib.copy'); grunt.loadNpmTasks('grunt-contrib-jshint'); // Register Tasks grunt.registerTask('default', ['jshint', 'concat', 'copy']); };
的package.json
{ "name": "kittenbook", "version": "0.0.1", "devDependencies": { "grunt": "~0.4.2", "grunt-contrib-concat": "~0.3.0", "grunt-contrib-jshint": "~0.6.3", "grunt-contrib-copy": "~0.5.0" } }
如果你需要其他信息,我会很乐意把它给你。 非常感谢你的帮助。
grunt-contrib.copy
应该是grunt-contrib-copy
(使用破折号而不是句号)