Node.js 如何让咕噜声工作。。?
在问这个问题之前,我已经读了很多不同的帖子,但我无法通过“丑不见”这个错误 我已经下载了node.js,uglfy.js。。很快我就完成了这里的所有步骤。。 我的Gruntjs文件:Node.js 如何让咕噜声工作。。?,node.js,gruntjs,uglifyjs,Node.js,Gruntjs,Uglifyjs,在问这个问题之前,我已经读了很多不同的帖子,但我无法通过“丑不见”这个错误 我已经下载了node.js,uglfy.js。。很快我就完成了这里的所有步骤。。 我的Gruntjs文件: module.exports = function (grunt) { grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), uglify: { build: {
module.exports = function (grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
uglify: {
build: {
src: 'js/global.js',
dest: 'js/build/global.min.js'
}
}
});
// Load the plugin that provides the "uglify" task.
grunt.loadNpmTasks('grunt-contrib-uglify');
// Default task(s).
grunt.registerTask('default', ['uglify']);
};
和package.json:
{
"name": "contentImageSlider",
"version": "0.1.0",
"devDependencies": {
"grunt": "^0.4.5",
"grunt-contrib-concat": "^0.4.0",
"grunt-contrib-jshint": "~0.10.0",
"grunt-contrib-nodeunit": "~0.3.3",
"grunt-contrib-uglify": "~0.4.0"
},
"description": "slider",
"main": "Gruntfile.js",
"dependencies": {
"grunt": "^0.4.5"
},
"scripts": {
"test": "test"
},
"repository": {
"type": "git",
"url": "https://github.com/haldunatar/contentImageSlider.git"
},
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/haldunatar/contentImageSlider/issues"
},
"homepage": "https://github.com/haldunatar/contentImageSlider"
}
错误:
Local Npm module "grunt-contrib-uglify" not found. is it installed?
Warning:Tast 'uglify' not found. use --force to continue.
Aborted due to warnings.
所以每次我输入“grunt”时,它都会给出那个错误..但是我下载了uglify.js
有人能帮我吗
提前谢谢 我看到“grunt contrib uglify”在您的
package.json
文件中,但错误表明它没有安装。也许您最近添加了依赖项,但没有执行npm安装
?尝试从根目录运行npm install
,然后重新运行grunt
您能提供grunfile.js
和package.json
文件吗?你能为失败的命令提供完整的输出吗?更新了我的问题..Thnx!天哪,莫利!!:)太多了!当然没问题,很高兴它成功了!您可能下载了丑陋的代码,但可能没有将其添加到正确的位置(在node\u modules
目录中)。通过使用npm install
您将确保依赖项安装在正确的位置。