![](/img/trans.png)
[英]Local Npm module “GRUNT-PLUGIN-MODULE” not found. Is it installed? What's causing this?
[英]grunt - getting “Local Npm module ”xxx“ not found. Is it installed?” What's causing this?
我剛剛收到了一份grunt包的副本,但是我是新手,我很難找到一些事情的答案。 最大的問題是不知道下面的錯誤來自哪里 - 有人能告訴我這是從哪里來的嗎? 這兩個文件都在同一目錄中。
$ grunt
>> Local Npm module "grunt-contrib-clean" not found. Is it installed?
>> 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-cssmin" not found. Is it installed?
>> Local Npm module "grunt-contrib-handlebars" not found. Is it installed?
>> Local Npm module "grunt-contrib-jshint" not found. Is it installed?
>> Local Npm module "grunt-contrib-qunit" not found. Is it installed?
>> Local Npm module "grunt-contrib-uglify" not found. Is it installed?
>> Local Npm module "grunt-preprocess" not found. Is it installed?
>> Local Npm module "grunt-wrap" not found. Is it installed?
>> Local Npm module "grunt-debug-task" not found. Is it installed?
Warning: Task "clean" not found. Use --force to continue.
Aborted due to warning.
$
這是我的package.json:
{
"name": "baked-widget",
"srcDirectory": "./src",
"srcJavascript": "./src/js",
"srcCss": "./src/css",
"srcData": "./src/data",
"testDirectory": "./test",
"tgtDirectory": "./build",
"installDirectory": "../com/public/widgets",
"version": "4.2.0",
"devDependencies": {
"grunt": "~0.4",
"grunt-contrib-clean": "~0.4.0",
"grunt-contrib-concat": "~0.3.0",
"grunt-contrib-copy": "~0.5.0",
"grunt-contrib-cssmin": "~0.9.0",
"grunt-contrib-handlebars": "~0.6",
"grunt-contrib-jshint": "~0.8",
"grunt-contrib-uglify": "~0.3",
"grunt-contrib-qunit": "~0.4",
"grunt-contrib-watch": "~0.5",
"grunt-preprocess": "~4.0",
"grunt-wrap": "~0.3",
"grunt-debug-task": "~0.1.4"
}
}
您可能沒有在本地安裝必要的軟件包。 嘗試npm install
( sudo npm install
)以確保你這樣做。
如果接受的答案不起作用且您有一個正確的package.json
文件,您可以:
刪除node_modules
文件夾(或在某處備份)
然后運行npm install
為了重新開始。
你必須告訴grunt在哪里找到node_modules。 我的Gruntfile以:
module.exports = function (grunt) {
// Tell grunt where to find node_modules
grunt.file.setBase('../../../../../');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-hub');
在我的例子中,node_modules文件夾比Gruntfile高5級(查看setBase方法)。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.