Javascript 我删除了package.json和Gruntfile.js,现在Grunt将不会加载依赖项

Javascript 我删除了package.json和Gruntfile.js,现在Grunt将不会加载依赖项,javascript,json,node.js,powershell,gruntjs,Javascript,Json,Node.js,Powershell,Gruntjs,因此,我无意中从项目目录中删除了package.json和Gruntfile文件夹,在此之前,我已经运行了grunt和grunt jshint,并且运行得非常好。我重新创建了两个文件(package.json和Gruntfile.js),现在当我尝试运行grunt或gruntjshint时,它告诉我 PS C:\Users\Vincent\desktop\projects\kittenbook> grunt jshint >> Local Npm module "grunt-c

因此,我无意中从项目目录中删除了package.json和Gruntfile文件夹,在此之前,我已经运行了
grunt
grunt jshint
,并且运行得非常好。我重新创建了两个文件(package.json和Gruntfile.js),现在当我尝试运行
grunt
gruntjshint
时,它告诉我

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显然已经安装好了

这是我的Grunfile.js,我必须重新制作。在我删除package.json文件之前,它运行得非常好

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']);

};
这是新的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"
  }

}
即使我第一次已经运行了Grunfile,我也应该运行上面的Grunfile吗?那会弄糟什么吗

我希望这不会太令人困惑。我是编程新手。谢谢

更新:当我尝试运行
npm安装时

PS C:\Users\Vincent> cd desktop/projects/kittenbook
PS C:\Users\Vincent\desktop\projects\kittenbook> npm install
npm WARN package.json kittenbook@1.0.0 No description
npm WARN package.json kittenbook@1.0.0 No repository field.
npm WARN package.json kittenbook@1.0.0 No README data
npm WARN package.json kittenbook@1.0.0 No license field.

更新:我犯的错误是Gruntfile.js不在我的项目文件夹中。。哇!lol.问题已解决。

在命令提示符中,转到项目目录并运行以下命令

npm install
您可能必须以管理员权限打开命令提示符才能使其工作


这将安装package.json文件中定义的所有npm模块。

在命令提示符中转到项目目录并运行以下命令

npm install
您可能必须以管理员权限打开命令提示符才能使其工作


这将安装package.json文件中定义的所有npm模块。

它们只是关于
package.json中缺少“字段”的警告。
只是关于
package.json中缺少“字段”的警告。