node.js 使用 npm 安装 angular/cli 时出错
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/50620434/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
error while installing angular/cli using npm
提问by prady
When I tried to install angular cli using this command
当我尝试使用此命令安装 angular cli 时
npm install -g @angular/cli
npm install -g @angular/cli
I got below mentioned error
我得到了下面提到的错误
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\@angular\cli\node_modules\chokidar\node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}) npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.1.2 (node_modules\@angular\cli\node_modules\watchpack\node_modules\chokidar\node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}) npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.1.2 (node_modules\@angular\cli\node_modules\webpack-dev-server\node_modules\chokidar\node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}) npm WARN [email protected] requires a peer of ajv@^6.0.0 but none was installed. npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\@angular\cli\node_modules\node-sass): npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] postinstall: `node scripts/build.js npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1
fsevents@^1.1.2 (node_modules\@angular\cli\node_modules\webpack-dev-server\node_modules\chokidar\node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: 不支持的平台 [email protected]: 想要{" os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}) npm WARN [email protected] requires a peer of ajv @^6.0.0 但没有安装。npm WARN 可选跳过可选依赖:[email protected] (node_modules\@angular\cli\node_modules\node-sass):npm WARN 可选跳过可选依赖:[email protected] 安装后:`node scripts/build .js npm WARN optional SKIPPING OPTIONAL DEPENDENCY: 退出状态 1 npm WARN notsup 跳过可选依赖项:[email protected] 不受支持的平台:想要 {"os":"darwin","arch":"any"}(当前:{"os":"win32","arch": "x64"}) npm WARN [email protected] 需要 ajv@^6.0.0 的同级,但没有安装。npm WARN 可选跳过可选依赖:[email protected] (node_modules\@angular\cli\node_modules\node-sass):npm WARN 可选跳过可选依赖:[email protected] 安装后:`node scripts/build .js npm WARN optional SKIPPING OPTIONAL DEPENDENCY: 退出状态 1 npm WARN notsup 跳过可选依赖项:[email protected] 不受支持的平台:想要 {"os":"darwin","arch":"any"}(当前:{"os":"win32","arch": "x64"}) npm WARN [email protected] 需要 ajv@^6.0.0 的同级,但没有安装。npm WARN 可选跳过可选依赖:[email protected] (node_modules\@angular\cli\node_modules\node-sass):npm WARN 可选跳过可选依赖:[email protected] 安装后:`node scripts/build .js npm WARN optional SKIPPING OPTIONAL DEPENDENCY: 退出状态 1 }) npm WARN [email protected] 需要 ajv@^6.0.0 的同级,但没有安装。npm WARN 可选跳过可选依赖:[email protected] (node_modules\@angular\cli\node_modules\node-sass):npm WARN 可选跳过可选依赖:[email protected] 安装后:`node scripts/build .js npm WARN optional SKIPPING OPTIONAL DEPENDENCY: 退出状态 1 }) npm WARN [email protected] 需要 ajv@^6.0.0 的同级,但没有安装。npm WARN 可选跳过可选依赖:[email protected] (node_modules\@angular\cli\node_modules\node-sass):npm WARN 可选跳过可选依赖:[email protected] 安装后:`node scripts/build .js npm WARN optional SKIPPING OPTIONAL DEPENDENCY: 退出状态 1
any idea whats the issue?
任何想法是什么问题?
my node version is 6.9.2 and npm version is 3.10.9
我的节点版本是 6.9.2,npm 版本是 3.10.9
回答by Seetharaman Mohan
Try using the below command from your project folder:
尝试使用项目文件夹中的以下命令:
npm audit fix
npm audit fix
If it still shows it has fixed only few of the vulnerabilities, then use the below command
如果它仍然显示它只修复了几个漏洞,则使用以下命令
npm audit fix --force
npm audit fix --force
回答by Mirko Jelic
This warning told everything:
这个警告说明了一切:
Unsupported platform for [email protected]: **wanted** {"os":"darwin","arch":"any"} (**current**: {"os":"win32","arch":"x64"})
Only unix-based systems use fsevents, and You are using Windows!
只有基于 unix 的系统使用fsevents,而您使用的是 Windows!
回答by james
$ npm install -g @angular/cli
C:\Users\Asus\Desktop\ng -> C:\Users\Asus\Desktop\node_modules\@angular\cli\bin\ng
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\@angular\cli\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
+ @angular/[email protected]
added 295 packages from 179 contributors in 120.715s
回答by Harvey
First of all, all the things you have posted are Warningsand not errors.
首先,您发布的所有内容都是警告而不是错误。
It means the npm has skipped the dependencies.
这意味着 npm 已跳过依赖项。
This would be solved if you update the npm version to the latest, use this command:
如果您将 npm 版本更新为最新版本,则可以解决此问题,请使用以下命令:
npm i -g npm@latest
// use sudoif you get permission error.
//如果出现权限错误,请使用sudo。
and try to install again.
并再次尝试安装。
Hope this helps.
希望这可以帮助。

