偶然、プロジェクトディレクトリからpackage.jsonとGruntfileフォルダを削除しました。その前に私はすでにgrunt
とgrunt jshint
を実行しました。良い。私は、再製の今両方のファイル(package.jsonとGruntfile.js)と私はgrunt
またはgrunt jshint
それは私に指示を実行しようとすると...私はpackage.jsonとGruntfile.jsを削除しましたが、Gruntは依存関係をロードしません
PS C:\Users\Vincent\desktop\projects\kittenbook> grunt jshint
>> Local Npm module "grunt-contrib-concat" not found. Is it installed?
>> Local Npm module "grunt-contrib-copy" not found. Is it installed?
>> Local Npm module "grunt-contrib-jshint" not found. Is it installed?
Warning: Task "jshint" not found. Use --force to continue.
を次にPowerShellがすぐ後にクラッシュします。
Npmの動作私はすでにチェックしており、Gruntは明らかにインストールされていることを知っています。
私が再作成した私のGruntfile.jsはここにあります。私はpackage.jsonファイルを削除する前に、新しいpackage.jsonファイル
{
"name": "kittenbook",
"version": "1.0.0",
"description": "",
"main": "index.js",
"devDependencies": {
"grunt": "^0.4.5",
"grunt-contrib-concat": "^0.3.0",
"grunt-contrib-copy": "^0.5.0",
"grunt-contrib-jshint": "^0.6.5",
"grunt-contrib-watch": "^1.0.0"
}
}
はまた、私は上記のGruntfileを実行する必要がありますそれは、私はすでにそれを最初に走ったにもかかわらず、ここで...
module.exports = function(grunt) {
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 plugin
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-jshint');
// Register tasks
grunt.registerTask('default', ['jshint', 'concat', 'copy']);
};
を完全に罰金走りました時間?それは何かを混乱させるだろうか?
私はこれがあまりにも混乱しないことを望みます。私はプログラミングでは新しいです。ありがとう!
アップデート:私はnpm install
PS C:\Users\Vincent> cd desktop/projects/kittenbook
PS C:\Users\Vincent\desktop\projects\kittenbook> npm install
npm WARN package.json [email protected] No description
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No README data
npm WARN package.json [email protected] No license field.
UPDATEを実行しよう:私が作った間違いはGruntfile.jsは私のプロジェクトフォルダの外にいたということでした。..うわー..笑。問題が解決しました。
あなたの 'package.json'に" fields "がないことに関する警告です。 – Andy