在Windows机器上安装多包npm的正确语法是什么?

时间:2016-06-09 18:03:39

标签: npm npm-install

本声明

npm install --save @angular2-material/{core,button,card}

(取自here)收益率

At line:1 char:44
+ npm install --save @angular2-material/{core,button,card}
+                                            ~
Missing argument in parameter list.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : MissingArgument
Windows PowerShell 中的

,它会产生

npm ERR! addLocal Could not install D:\VST\ngMaterial1\@angular2-material\{core,button,card}
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "D:\\nodejs\\node.exe" "D:\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "--save" "@angular2-material/{core,button,card}"
npm ERR! node v5.10.1
npm ERR! npm  v3.8.3
npm ERR! path D:\VST\ngMaterial1\@angular2-material\{core,button,card}
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall open

npm ERR! enoent ENOENT: no such file or directory, open 'D:\VST\ngMaterial1\@angular2-material\{core,button,card}'
npm ERR! enoent ENOENT: no such file or directory, open 'D:\VST\ngMaterial1\@angular2-material\{core,button,card}'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! Please include the following file with any support request:
npm ERR!     D:\VST\ngMaterial1\npm-debug.log

在Windows 控制台中(以及{em> PowerShell ,当--save参数包含在引号中时)。

Windows机器上多包npm安装的正确语法是什么?

3 个答案:

答案 0 :(得分:1)

正确的命令是npm i lodash hapi thinky when。您可以阅读更多npm提示here

答案 1 :(得分:1)

以下命令:

npm install --save @angular2-material/{core,button,card}

由bash扩展为:

npm install --save @angular2-material/core @angular2-material/button @angular2-material/card

在Windows上,您可以使用MingW Bash来实现完全相同的功能,也可以手动展开命令。

答案 2 :(得分:1)

{package1, package2...}技巧特定于bash。这在powershell或cmd中不起作用。要在Windows上运行此工作,请打开一个新的git bash(或等效的)终端并运行该命令,它应该可以正常工作。