2016-07-07 14 views
0

package.jsonのパッケージを現在のディレクトリにインストールするには、npm installコマンドを実行する必要があります。 ?亭と一息タスクのための特定のディレクトリにnpmパッケージをインストールするには

は、それがそのフォルダに行くことなく、特定のフォルダにpackage.jsonのためのパッケージをインストールすることは可能です `

すでに見つかっソリューション:

bower install --config.cwd=<directory> 
gulp build --cwd <directory> 

しかしnpm

のための同様の機能が不足して

コマンドを実行すると:npm install --prefix C:\Users\ng\Projects\Lottery\src\SPA エラーが表示されます。

npm ERR! addLocal Could not install C:\Users\ng\Projects 
npm ERR! Windows_NT 10.0.10586 
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "--prefix" "C:\\Users\\ng\\Projects\\Lottery\\src\\SPA" 
npm ERR! node v6.2.1 
npm ERR! npm v3.9.3 
npm ERR! code EISDIR 
npm ERR! errno -4068 
npm ERR! syscall read 

npm ERR! eisdir EISDIR: illegal operation on a directory, read 
npm ERR! eisdir This is most likely not a problem with npm itself 
npm ERR! eisdir and is related to npm not being able to find a package.json in 
npm ERR! eisdir a package you are trying to install. 

npm ERR! Please include the following file with any support request: 
npm ERR!  C:\Users\ng\Projects\npm-debug.log 

そしてdocumentationから:

The prefix config defaults to the location where node is installed. On most systems, this is /usr/local. On windows, this is the exact location of the node.exe binary

+1

[指定されたディレクトリにnpmをインストールする方法は?](http://stackoverflow.com/questions/14469515/how-to-npm-install-to-a-specified-directory) –

+0

@anshumansinghが変更されました問題を説明するための私の質問 – Uriil

答えて

1

これは解決する必要があります:How to npm install to a specified directory?

基本的には、グローバルオプションと一緒にprefixオプションを使用している:npm install --prefix <path/to/prefix_folder> -g

あなたはまた持つことができますdocumentationを見てください。

+0

おそらく書き込み権限がありません。たとえば、フォルダを使用しようとします。あなたのデスクトップに。 – nidhoeggr09

+0

-gオプションを使用しましたか? – nidhoeggr09

+0

ドキュメントには、「グローバルフラグが設定されていると、npmはこの接頭辞に何かをインストールします。設定されていなければ、現在のパッケージのルートを使用するか、パッケージにない場合は現在の作業ディレクトリを使用します。 – nidhoeggr09

関連する問題