簡體   English   中英

安裝后找不到本地Grunt

[英]Unable to find local Grunt after install

當我運行gruntgrunt -v ,出現錯誤:

grunt-cli: The grunt command line interface (v1.2.0)

Fatal error: Unable to find local grunt.

If you're seeing this message, grunt hasn't been installed locally to
your project. For more information about installing and configuring grunt,
please see the Getting Started guide:

http://gruntjs.com/getting-started

我在項目根目錄中,並嘗試在本地,全局且沒有標志的情況下安裝grunt(我是使用npm的初學者)

npm install -g grunt

npm install grunt

npm install grunt --save-dev

在安裝新/舊軟件包后,我也多次運行npm install

這是我的package.json依賴項:

"dependencies": {
    "@webcomponents/webcomponentsjs": "^2.1.0",
    "babel-plugin-transform-es2015-modules-amd": "^6.24.1",
    "babel-preset-es2015": "^6.24.1",
    "babelify": "^8.0.0",
    "browserify": "^16.2.2",
    "npm-check-updates": "^2.14.2",
    "requirejs": "^2.3.6",
    "rollup-plugin-node-resolve": "^3.3.0"
  },
  "devDependencies": {
    "autoprefixer": "^9.1.3",
    "babel": "^6.23.0",
    "babel-cli": "^6.26.0",
    "babel-preset-env": "^1.7.0",
    "cssnext": "^1.8.4",
    "grunt": "^1.0.3",
    "grunt-babel": "^7.0.0",
    "grunt-browserify": "^5.3.0",
    "grunt-concurrent": "^2.3.1",
    "grunt-contrib-copy": "^1.0.0",
    "grunt-contrib-csslint": "^2.0.0",
    "grunt-contrib-jshint": "^1.1.0",
    "grunt-contrib-sass": "^1.0.0",
    "grunt-contrib-watch": "^1.1.0",
    "grunt-postcss": "^0.9.0",
    "grunt-serve": "^0.1.6",
    "load-grunt-tasks": "^4.0.0",
    "material-components-web": "^0.39.1",
    "pixrem": "^4.0.1",
    "postcss-cssnext": "^3.1.0",
    "precss": "^3.1.2",
    "webpack-cli": "^3.1.2"
  }

可能會導致某個地方出現差異嗎? 我已經在StackOverflow 引用了以下GitHub線程和其他答案,並遵循了他們的建議,但很茫然。

直到執行此命令后,我才出現此錯誤,如本文中有關使用Browserify / Babel輸出多個包的文章所示:

npm install grunt grunt-cli grunt-browserify babelify babel-preset-es2015 --save-dev

我不確定為什么會破壞事情。 npm不會自動安裝最新的軟件包嗎? 我應該嘗試單獨卸載那些軟件包嗎?

當我運行npm install grunt ,我不斷看到這些警告:

npm WARN grunt-serve@0.1.6 requires a peer of grunt@~0.4.0 but none is installed. You must install peer dependencies yourself.
npm WARN webpack-cli@3.1.2 requires a peer of webpack@^4.x.x but none is installed. You must install peer dependencies yourself.

這可能與問題有關嗎?

謝謝

我能夠通過將我的Node.js系統安裝更新為類似帖子上的評論者的建議來解決此問題(在我的歷史記錄中找不到),將我的Node.js系統安裝更新為64位版本。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM