【发布时间】:2017-02-15 18:44:33
【问题描述】:
我在尝试在不同文件夹上实现 grunt 时遇到问题,在我的根目录中:
<root>/package.json
<root>/node_modules
在另一个文件夹中,我的 gruntfile 包含不同的子文件夹和我工作的文件:
<root>/apps/static/Gruntfile.js
如果我进入根目录并执行
grunt --gruntfile /apps/static/Gruntfile.js MyTaskName
我明白了:
找不到本地 Npm 模块“grunt-contrib-concat”。安装了吗?
找不到本地 Npm 模块“grunt-contrib-cssmin”。安装了吗?
找不到本地 Npm 模块“grunt-contrib-clean”。安装了吗?
找不到本地 Npm 模块“grunt-contrib-watch”。安装了吗?
未找到本地 Npm 模块“grunt-contrib-uglify”。安装了吗?
我运行了几次 npm install。
在我的 gruntfile.js 上你有
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-uglify');
我三重检查,文件夹没问题(事实上,最初 gruntfile 和包在同一个文件夹中,一切正常,运行多个任务,一切正常)。我真的需要在 root 上有一个通用的 package.json 和 node_modules,在特定的项目文件夹上有一个 Gruntfile.js
知道发生了什么吗?提前致谢
【问题讨论】:
标签: javascript node.js npm gruntjs