使用angular/cli设置新项目时出错 [英] Error setting up new project with angular/cli

查看:290
本文介绍了使用angular/cli设置新项目时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是npm和Angular 2的新手,我正在尝试使用angular/cli建立一个新的Angular 2项目.

I am new to npm and Angular 2, I am trying to setup a new Angular 2 project using angular/cli.

我当前正在跑步:

节点v8.9.3 npm v5.6.0 Windows 10

Node v8.9.3 npm v5.6.0 Windows 10

首先,我运行了npm install -g @angular/cli,它似乎安装得很好.然后我转到要启动项目的文件夹,运行ng new my-app,但一直收到此错误.

First, I ran npm install -g @angular/cli which seemed to install just fine. Then I went to the folder where I wanted to start my project, ran ng new my-app but kept getting this error.

npm WARN不推荐使用angular-cli@1.0.0-beta.22-1:angular-cli已被 重命名为@ angular/cli.请更新您的依赖项.

npm WARN deprecated angular-cli@1.0.0-beta.22-1: angular-cli has been renamed to @angular/cli. Please update your dependencies.

npm WARN不推荐使用hard-cookie@2.2.2:ReDoS漏洞解析 Set-Cookie https://nodesecurity.io/advisories/130

npm WARN deprecated tough-cookie@2.2.2: ReDoS vulnerability parsing Set-Cookie https://nodesecurity.io/advisories/130

npm WARN不推荐使用的node-uuid@1.4.8:改用uuid模块

npm WARN deprecated node-uuid@1.4.8: Use uuid module instead

npm WARN不推荐使用graceful-fs@3.0.11:请升级到graceful-fs 4与当前和将来的Node.js版本兼容

npm WARN deprecated graceful-fs@3.0.11: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js

npm WARN不建议使用minimatch@0.3.0:请更新为minimatch 3.0.2 或更高版本,以避免RegExp DoS问题

npm WARN deprecated minimatch@0.3.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue

npm WARN不建议使用minimatch@2.0.10:请更新为minimatch 3.0.2 或更高版本,以避免RegExp DoS问题

npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue

npm WARN不推荐使用graceful-fs@1.2.3:请升级到graceful-fs 4 与当前和将来的Node.js版本兼容

npm WARN deprecated graceful-fs@1.2.3: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js

npm WARN codelyzer@2.0.1需要一个@ angular/compiler @ ^ 2.3.1的同位体 || > = 4.0.0-beta <5.0.0,但未安装.您必须安装对等 自己依赖.

npm WARN codelyzer@2.0.1 requires a peer of @angular/compiler@^2.3.1 || >=4.0.0-beta <5.0.0 but none is installed. You must install peer dependencies yourself.

npm WARN codelyzer@2.0.1需要一个@ angular/core @ ^ 2.3.1 ||

npm WARN codelyzer@2.0.1 requires a peer of @angular/core@^2.3.1 ||

= 4.0.0-beta <5.0.0,但未安装.您必须自己安装对等依赖项.

=4.0.0-beta <5.0.0 but none is installed. You must install peer dependencies yourself.

npm WARN @ ngtools/webpack @ 1.9.0需要一个webpack@^2.2.0的对等项|| ^ 3.0.0,但未安装.您必须安装对等依赖项 你自己.

npm WARN @ngtools/webpack@1.9.0 requires a peer of webpack@^2.2.0 || ^3.0.0 but none is installed. You must install peer dependencies yourself.

npm WARN extract-text-webpack-plugin@2.1.2需要一个对等体 webpack@^2.2.0,但未安装.您必须安装对等 自己依赖.

npm WARN extract-text-webpack-plugin@2.1.2 requires a peer of webpack@^2.2.0 but none is installed. You must install peer dependencies yourself.

npm WARN string-replace-loader@1.3.0需要一个webpack @ 1的对等项|| 2个 || 3,但未安装.您必须安装对等依赖项 你自己.

npm WARN string-replace-loader@1.3.0 requires a peer of webpack@1 || 2 || 3 but none is installed. You must install peer dependencies yourself.

npm WARN tslint-loader@2.1.5需要tslint@^3.0.0的同位体,但没有 已安装.您必须自己安装对等依赖项.

npm WARN tslint-loader@2.1.5 requires a peer of tslint@^3.0.0 but none is installed. You must install peer dependencies yourself.

npm WARN webpack-dev-middleware@1.12.2需要一个对等体 webpack@^1.0.0 || ^ 2.0.0 || ^ 3.0.0,但未安装.你必须 自己安装对等依赖项.

npm WARN webpack-dev-middleware@1.12.2 requires a peer of webpack@^1.0.0 || ^2.0.0 || ^3.0.0 but none is installed. You must install peer dependencies yourself.

npm警告可选的跳过选择性依赖:fsevents@1.1.3 (node_modules \ fsevents):

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.3 (node_modules\fsevents):

npm警告不支持跳过可选依赖项:不支持的平台 fsevents@1.1.3:通缉{"os":"darwin","arch":"any"}(当前: {"os":"win32","arch":"x64"})

npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

npm ERR!路径C:\ Web Development \ Projects \ angular 2 练习\ my-app \ node_modules \ @ angular-cli \ ast-tools \ node_modules \ mkdirp \ bin \ cmd.js

npm ERR! path C:\Web Development\Projects\angular 2 practice\my-app\node_modules\@angular-cli\ast-tools\node_modules\mkdirp\bin\cmd.js

npm ERR!代码ENOENT

npm ERR! code ENOENT

npm ERR! errno -4058

npm ERR! errno -4058

npm ERR!系统调用chmod

npm ERR! syscall chmod

npm ERR! enoent ENOENT:没有这样的文件或目录,chmod'C:\ Web 开发\项目\角度2 练习\ my-app \ node_modules \ @ angular-cli \ ast-tools \ node_modules \ mkdirp \ bin \ cmd.js'

npm ERR! enoent ENOENT: no such file or directory, chmod 'C:\Web Development\Projects\angular 2 practice\my-app\node_modules\@angular-cli\ast-tools\node_modules\mkdirp\bin\cmd.js'

npm ERR! enoent这与npm无法找到文件有关.

npm ERR! enoent This is related to npm not being able to find a file.

npm ERR!先天

npm ERR! enoent

npm ERR!可以在以下位置找到此运行的完整日志:

npm ERR! A complete log of this run can be found in:

npm ERR! C:\ Users \ Jason Kervin \ AppData \ Roaming \ npm-cache_logs \ 2017-12-12T00_57_54_496Z-debug.log

npm ERR! C:\Users\Jason Kervin\AppData\Roaming\npm-cache_logs\2017-12-12T00_57_54_496Z-debug.log

软件包安装失败,请参见上文.

Package install failed, see above.

推荐答案

从命令行运行

ng -v

这应该输出1.6.0.如果不是,则说明您安装了较旧版本的CLI.

This should output 1.6.0. If it doesn't you have an older version of the CLI installed.

运行:

npm cache --force clean

然后:

npm install @angular/cli -g

如果这样不起作用,请删除C:\Users\<username>\AppData\Roaming

If that doesnt work remove the folders in C:\Users\<username>\AppData\Roaming

这篇关于使用angular/cli设置新项目时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆