質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
npm

npmは、Node Packaged Modulesの略。Node.jsのライブラリ・パッケージを管理できるツールです。様々なモジュールを簡単にインストールでき、自分でモジュールを作成し公開する際にも使用できます。

Node.js

Node.jsとはGoogleのV8 JavaScriptエンジンを使用しているサーバーサイドのイベント駆動型プログラムです。

Grunt

Gruntは、JavaScriptで記述されたタスクを実行するアプリケーションです。タスクランナーと呼ばれる自動化ツールで、様々な作業を自動化して開発の効率を高めます。コマンド実行やファイル保存などの際の自動実行が可能です。

Q&A

解決済

1回答

7284閲覧

NPMでGruntをインストールしようとするとエラー

yuta0801

総合スコア270

npm

npmは、Node Packaged Modulesの略。Node.jsのライブラリ・パッケージを管理できるツールです。様々なモジュールを簡単にインストールでき、自分でモジュールを作成し公開する際にも使用できます。

Node.js

Node.jsとはGoogleのV8 JavaScriptエンジンを使用しているサーバーサイドのイベント駆動型プログラムです。

Grunt

Gruntは、JavaScriptで記述されたタスクを実行するアプリケーションです。タスクランナーと呼ばれる自動化ツールで、様々な作業を自動化して開発の効率を高めます。コマンド実行やファイル保存などの際の自動実行が可能です。

0グッド

0クリップ

投稿2017/05/05 21:44

###前提・実現したいこと
NPMでGruntをnpm install grunt --save-devでインストールしようとすると以下のように表示されてインストールできません。
ちなみにコマンドラインインターフェイス(grunt-cli)の方はインストール出来ました

###発生している問題・エラーメッセージ

PS D:\programming\node\grunt> npm install grunt --save-dev npm WARN install Usage of the `--dev` option is deprecated. Use `--only=dev` instead. npm ERR! code ENOSELF npm ERR! Refusing to install package with name "grunt" under a package npm ERR! also called "grunt". Did you name your project the same npm ERR! as the dependency you're installing? npm ERR! npm ERR! For more information, see: npm ERR! <https://docs.npmjs.com/cli/install#limitations-of-npms-install-algorithm> npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\Yuta\AppData\Roaming\npm-cache\_logs\2017-05-05T21_34_51_834Z-debug.log
0 info it worked if it ends with ok 1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe', 1 verbose cli 'C:\\Users\\Yuta\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js', 1 verbose cli 'install', 1 verbose cli 'grunt', 1 verbose cli '--save-dev' ] 2 info using npm@4.5.0 3 info using node@v6.9.5 4 warn install Usage of the `--dev` option is deprecated. Use `--only=dev` instead. 5 silly loadCurrentTree Starting 6 silly install loadCurrentTree 7 silly install readLocalPackageData 8 silly fetchPackageMetaData grunt 9 silly fetchNamedPackageData grunt 10 silly mapToRegistry name grunt 11 silly mapToRegistry using default registry 12 silly mapToRegistry registry https://registry.npmjs.org/ 13 silly mapToRegistry data Result { 13 silly mapToRegistry raw: 'grunt', 13 silly mapToRegistry scope: null, 13 silly mapToRegistry escapedName: 'grunt', 13 silly mapToRegistry name: 'grunt', 13 silly mapToRegistry rawSpec: '', 13 silly mapToRegistry spec: 'latest', 13 silly mapToRegistry type: 'tag' } 14 silly mapToRegistry uri https://registry.npmjs.org/grunt 15 verbose request uri https://registry.npmjs.org/grunt 16 verbose request no auth needed 17 info attempt registry request try #1 at 06:34:51 18 verbose request id 35d3e0cbc4e6cf84 19 verbose etag W/"5908df16-18b04" 20 verbose lastModified Tue, 02 May 2017 19:33:42 GMT 21 http request GET https://registry.npmjs.org/grunt 22 http 304 https://registry.npmjs.org/grunt 23 verbose headers { date: 'Fri, 05 May 2017 21:34:50 GMT', 23 verbose headers via: '1.1 varnish', 23 verbose headers 'cache-control': 'max-age=300', 23 verbose headers etag: 'W/"5908df16-18b04"', 23 verbose headers age: '200', 23 verbose headers connection: 'keep-alive', 23 verbose headers 'x-served-by': 'cache-nrt6121-NRT', 23 verbose headers 'x-cache': 'HIT', 23 verbose headers 'x-cache-hits': '1', 23 verbose headers 'x-timer': 'S1494020090.151093,VS0,VE0', 23 verbose headers vary: 'Accept-Encoding' } 24 silly get cb [ 304, 24 silly get { date: 'Fri, 05 May 2017 21:34:50 GMT', 24 silly get via: '1.1 varnish', 24 silly get 'cache-control': 'max-age=300', 24 silly get etag: 'W/"5908df16-18b04"', 24 silly get age: '200', 24 silly get connection: 'keep-alive', 24 silly get 'x-served-by': 'cache-nrt6121-NRT', 24 silly get 'x-cache': 'HIT', 24 silly get 'x-cache-hits': '1', 24 silly get 'x-timer': 'S1494020090.151093,VS0,VE0', 24 silly get vary: 'Accept-Encoding' } ] 25 verbose etag https://registry.npmjs.org/grunt from cache 26 verbose get saving grunt to C:\Users\Yuta\AppData\Roaming\npm-cache\registry.npmjs.org\grunt\.cache.json 27 verbose correctMkdir C:\Users\Yuta\AppData\Roaming\npm-cache correctMkdir not in flight; initializing 28 silly install normalizeTree 29 silly loadCurrentTree Finishing 30 silly loadIdealTree Starting 31 silly install loadIdealTree 32 silly cloneCurrentTree Starting 33 silly install cloneCurrentTreeToIdealTree 34 silly cloneCurrentTree Finishing 35 silly loadShrinkwrap Starting 36 silly install loadShrinkwrap 37 silly loadShrinkwrap Finishing 38 silly loadAllDepsIntoIdealTree Starting 39 silly install loadAllDepsIntoIdealTree 40 silly rollbackFailedOptional Starting 41 silly rollbackFailedOptional Finishing 42 silly runTopLevelLifecycles Finishing 43 silly install printInstalled 44 verbose stack Error: Refusing to install package with name "grunt" under a package 44 verbose stack also called "grunt". Did you name your project the same 44 verbose stack as the dependency you're installing? 44 verbose stack 44 verbose stack For more information, see: 44 verbose stack <https://docs.npmjs.com/cli/install#limitations-of-npms-install-algorithm> 44 verbose stack at checkSelf (C:\Users\Yuta\AppData\Roaming\npm\node_modules\npm\lib\install\validate-args.js:53:14) 44 verbose stack at Array.<anonymous> (C:\Users\Yuta\AppData\Roaming\npm\node_modules\npm\node_modules\slide\lib\bind-actor.js:15:8) 44 verbose stack at LOOP (C:\Users\Yuta\AppData\Roaming\npm\node_modules\npm\node_modules\slide\lib\chain.js:15:14) 44 verbose stack at chain (C:\Users\Yuta\AppData\Roaming\npm\node_modules\npm\node_modules\slide\lib\chain.js:20:5) 44 verbose stack at C:\Users\Yuta\AppData\Roaming\npm\node_modules\npm\lib\install\validate-args.js:16:5 44 verbose stack at C:\Users\Yuta\AppData\Roaming\npm\node_modules\npm\node_modules\slide\lib\async-map.js:52:35 44 verbose stack at Array.forEach (native) 44 verbose stack at C:\Users\Yuta\AppData\Roaming\npm\node_modules\npm\node_modules\slide\lib\async-map.js:52:11 44 verbose stack at Array.forEach (native) 44 verbose stack at asyncMap (C:\Users\Yuta\AppData\Roaming\npm\node_modules\npm\node_modules\slide\lib\async-map.js:51:8) 44 verbose stack at module.exports (C:\Users\Yuta\AppData\Roaming\npm\node_modules\npm\lib\install\validate-args.js:15:3) 44 verbose stack at Array.<anonymous> (C:\Users\Yuta\AppData\Roaming\npm\node_modules\npm\node_modules\slide\lib\bind-actor.js:15:8) 44 verbose stack at LOOP (C:\Users\Yuta\AppData\Roaming\npm\node_modules\npm\node_modules\slide\lib\chain.js:15:14) 44 verbose stack at chain (C:\Users\Yuta\AppData\Roaming\npm\node_modules\npm\node_modules\slide\lib\chain.js:20:5) 44 verbose stack at Object.Installer.loadAllDepsIntoIdealTree (C:\Users\Yuta\AppData\Roaming\npm\node_modules\npm\lib\install.js:408:3) 44 verbose stack at Array.<anonymous> (C:\Users\Yuta\AppData\Roaming\npm\node_modules\npm\node_modules\slide\lib\bind-actor.js:15:8) 45 verbose cwd D:\programming\node\grunt 46 verbose Windows_NT 10.0.15063 47 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Yuta\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "grunt" "--save-dev" 48 verbose node v6.9.5 49 verbose npm v4.5.0 50 error code ENOSELF 51 error Refusing to install package with name "grunt" under a package 51 error also called "grunt". Did you name your project the same 51 error as the dependency you're installing? 51 error 51 error For more information, see: 51 error <https://docs.npmjs.com/cli/install#limitations-of-npms-install-algorithm> 52 verbose exit [ 1, true ]

###試したこと

  • npm cache cleanの実行
  • node-modulesの削除
  • C:\Users<username>\AppData\Local\Temp以下のフォルダの削除

###補足情報(言語/FW/ツール等のバージョンなど)
node v6.9.5
npm v4.5.0

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

ベストアンサー

http://root3.hatenablog.com/entry/2016/08/29/225231

grunt フォルダ内で grunt をインストールすることは出来ません。
フォルダ名とpackage.jsonにかかれている名前を適当な名前へ変更してやってください

投稿2017/05/05 22:18

TakeoAsai

総合スコア880

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問