npm install <module>
のコマンドは、モジュールを常に意図的にユーザーのホームディレクトリにインストールしません。どのような設定がこの動作を引き起こしますか? モジュールを現在のパスにインストールするだけです。私がモジュールをインストールしようとすると、例えばデスクトップのフォルダにホームディレクトリがインストールされます。npmはモジュールをホームディレクトリにインストールします
mymac:testfolder myuser$ pwd
/Users/myuser/Desktop/untitledfolder
mymac:testfolder myuser$ npm install async
npm http GET https://registry.npmjs.org/async
npm http 304 https://registry.npmjs.org/async
npm http GET https://registry.npmjs.org/lodash
npm http 304 https://registry.npmjs.org/lodash
[email protected] ../../node_modules/async
└── [email protected]
あなたが見るように、それは../../node_modules/
にモジュールをインストールします。私はpackage.jsonファイルをtestfolderに持っていません。
'npm root'とは何ですか? – dhke
それは/ Users/myuser/node_modulesを与えます – Adem