要在当前目录中安装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
[如何将npm安装到指定目录?](http://stackoverflow.com/questions/14469515/how-to-npm-install-to-a-specified-directory) –
@anshumansingh modified我的问题来解释问题 – Uriil