简体   繁体   English

Angular 9 ng new myapp 给出错误原理图工作流失败

[英]Angular 9 ng new myapp gives error The Schematic workflow failed

I have angular 9 installed我安装了 angular 9

Angular CLI: 9.0.1 Node: 13.8.0 OS: win32 x64 Angular CLI:9.0.1 节点:13.8.0 操作系统:win32 x64

Angular: ... Ivy Workspace:角度:...常春藤工作区:

Package Version套餐版本

@angular-devkit/architect 0.900.1 @angular-devkit/架构师 0.900.1
@angular-devkit/core 9.0.1 @angular-devkit/core 9.0.1
@angular-devkit/schematics 9.0.1 @angular-devkit/schematics 9.0.1
@schematics/angular 9.0.1 @原理图/角度 9.0.1
@schematics/update 0.900.1 @原理图/更新 0.900.1
rxjs 6.5.3 rxjs 6.5.3

Everytime i try to create a new project with ng new, I'm getting the message每次我尝试使用 ng new 创建一个新项目时,我都会收到消息

Installing packages...npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142 npm ERR!安装包... npm WARN deprecated request@2.88.2: request 已被弃用,参见https://github.com/request/request/issues/3142 npm ERR! Unexpected end of JSON input while parsing near '...pm-signature":"-----B' npm ERR!解析 '...pm-signature":"-----B' npm ERR 附近时,JSON 输入意外结束! A complete log of this run can be found in: npm ERR!可以在以下位置找到此运行的完整日志:npm ERR! C:\\Users\\Lijo John Daniel\\AppData\\Roaming\\npm-cache_logs\\2020-02-12T09_52_57_342Z-debug.log × Package install failed, see above. C:\\Users\\Lijo John Daniel\\AppData\\Roaming\\npm-cache_logs\\2020-02-12T09_52_57_342Z-debug.log × 包安装失败,见上。 The Schematic workflow failed.原理图工作流失败。 See above.看上面。

I have tried re-installing angular and even node but issue still remains我尝试重新安装 angular 甚至 node,但问题仍然存在

My OS version is Win 10 v.1909 build 18363.592.我的操作系统版本是 Win 10 v.1909 build 18363.592。 Can someone help me with this?有人可以帮我弄这个吗?

First ,verify your NPM cached memory首先,验证您的 NPM 缓存内存

npm cache verify

then try :然后尝试:

npm cache clean --force
npm install –g @angular/cli@latest 
ng new <YourProjectName>

If the problem persists, then try the following如果问题仍然存在,请尝试以下操作

npm cache clean --force
npm update
ng new <YourProjectName>
NOTE笔记
As @0210vidit said in the comment below: 正如@0210vidit 在下面的评论中所说:

do not use dash(-) or (.) in naming不要在命名中使用破折号 (-) 或 (.)

Try to clean the npm cache using:尝试使用以下方法清理npm 缓存:

npm cache clean --force

then should it works now,那么它现在应该可以工作了,

ng new my-app

I had similar issue and installing yarn or clearing cache didn't help.我有类似的问题,安装纱线或清除缓存没有帮助。 I removed '-' from my app name and it worked我从我的应用程序名称中删除了“-”并且它起作用了

Error :错误 :

ng new first-app

Solved:解决了:

ng new firstapp

Hope it helps.希望能帮助到你。

I had this issue since yesterday, tried all of this and it did not work.我从昨天开始就有这个问题,尝试了所有这些,但没有奏效。 Then I installed yarn, and configured angular cli to use yarn as the packagemanager by running this command ng config -g cli.packageManager yarn , and it worked.然后我安装了 yarn,并通过运行这个命令ng config -g cli.packageManager yarn将 angular cli 配置为使用 yarn 作为包管理器,并且它工作正常。

This issue is reported for angular 9 and multiple geo-locations are facing this problem.角度 9 报告了此问题,并且多个地理位置都面临此问题。 refer https://github.com/angular/angular-cli/issues/16944参考https://github.com/angular/angular-cli/issues/16944

to proceed you can bring you angular version to 8 with below steps要继续,您可以通过以下步骤将角度版本提升到 8

ng --version ng --version

npm uninstall -g @angular/cli npm uninstall -g @angular/cli

npm cache clean --force npm 缓存清理 --force

npm install -g @angular/cli@8.0.0 npm install -g @angular/cli@8.0.0

ng --version ng --version

First try the following首先尝试以下

npm cache clean --force
npm install -g @angular/cli
ng new <project-name>

If the problem persists, then try this ( this eventually solved my workflow issue )如果问题仍然存在,请尝试此操作(这最终解决了我的工作流程问题

npm cache clean --force
npm update
ng new <project-name>

Thanks!谢谢!

In my case i've tried everything with npm and no way out.就我而言,我已经用 npm 尝试了所有方法,但没有出路。

But with yarn worked with no worries!但是使用纱线可以毫无后顾之忧!

I'm a windows user but you can find how to install in other OS in yarn website!我是 Windows 用户,但您可以在 yarn 网站上找到如何在其他操作系统中安装!

1st - i downloaded yarn from his website yarn 1st - 我从他的网站yarn下载了yarn

2nd - installed the global package with vs terminal: yarn global add @angular/cli 2nd - 使用 vs 终端安装全局包:yarn global add @angular/cli

3rd - still in vs terminal set: ng config -g cli.packageManager yarn第三个 - 仍然在 vs 终端集:ng config -g cli.packageManager yarn

4th - i created my app: ng new myapp 4 - 我创建了我的应用程序:ng new myapp

5th - so you know te rest ...第五 - 所以你知道你休息......

Worked fine to me!对我来说很好用!

I removed my previous solution as I somehow got hung up on the uninstalled node_modules part and presented a solution that probably wouldn't have been relevant.我删除了我以前的解决方案,因为我以某种方式挂断了已卸载的 node_modules 部分,并提出了一个可能不相关的解决方案。 Here is an alternate solution that might work for you...这是一个可能对您有用的替代解决方案......

Open a new terminal and run node -v and then npm -v to make sure you are running compatible versions: "Node 8.9 or higher, together with NPM 5.5.1 or higher" Uninstall your current Global Angular cli npm uninstall -g @angular/cli Run npm cache verify Re-Install Angular CLI npm install -g @angular/cli@latest Close your terminal window (just because).打开一个新终端并运行 node -v 然后npm -v以确保您运行的是兼容版本:“Node 8.9 或更高版本,以及 NPM 5.5.1 或更高版本”卸载您当前的 Global Angular cli npm uninstall -g @angular/cli运行 npm cache verify 重新安装 Angular CLI npm install -g @angular/cli@latest 关闭你的终端窗口(只是因为)。 Open a new terminal window, browse to where you want your new project and try the 'ng new` command again.打开一个新的终端窗口,浏览到您想要新项目的位置,然后再次尝试“ng new”命令。

This work fine top of all solutions and worked for me on Windows 10... Go to vs code new terminal type the following in order这项工作在所有解决方案中都非常出色,并且在 Windows 10 上对我有用...转到 vs 代码新终端按顺序键入以下内容

  1. npm install --global yarn npm install --global yarn
  2. yarn global add @angular/cli纱线全局添加@angular/cli
  3. ng config -g cli.packageManager yarn ng config -g cli.packageManager yarn
  4. ng new projectname ng 新项目名称

this will fix the issue..这将解决问题..

I got it working, first I installed angular 8 then ran npm install -g @angular/cli@latest.我让它工作了,首先我安装了 angular 8,然后运行 ​​npm install -g @angular/cli@latest。 It updated to angular 9 and now i'm able to create new projects.它更新为 angular 9,现在我可以创建新项目了。 Thank you all for your consideration谢谢大家的考虑

Angular 9 ng new myapp gives error The Schematic workflow failed...... Angular 9 ng new myapp给出错误原理图工作流失败......

Firstly, uninstall Angular: npm uninstall -g @angular/cli首先,卸载 Angular: npm uninstall -g @angular/cli

After uninstall, you should do clean Angular cache: npm cache clean --force卸载后,您应该清理 Angular 缓存: npm cache clean --force

After this, you should do re-install Angular globally: npm install -g @angular/cli在此之后,您应该全局重新安装 Angular: npm install -g @angular/cli

And check the version: ng --version并检查版本: ng --version

Now you can create your app: ng new your-app现在您可以创建您的应用程序: ng new your-app

Only solution worked for me唯一的解决方案对我有用

  1. Clear NPM cache + uninstall node清除 NPM 缓存 + 卸载节点

  2. Install Node.js安装 Node.js

  3. Install Angular CLI安装 Angular CLI

This will cost you some Internet data, but better option than wandering around for nothing!这将花费您一些 Internet 数据,但比无所事事闲逛更好的选择! Keep a back up of Node.js.备份 Node.js。 Useful next time.下次有用。

Here is the simple way, i am sure it will help because this is the error with package installation failed .这是简单的方法,我相信它会有所帮助,因为这是包安装失败的错误。

Skip node packages for now and use this command to create new app.暂时跳过节点包并使用此命令创建新应用程序。

ng new YourAppName --skip-install

after that just go into your project directory and run npm install it will install all required packages for you.之后只需进入您的项目目录并运行 npm install 它将为您安装所有必需的包。

I struggled with this type of issue for a while.我在这类问题上挣扎了一段时间。

Adding the following environment variable to your user account should solve the issue, adding a temporary cache option.将以下环境变量添加到您的用户帐户应该可以解决问题,添加一个临时缓存选项。

  • name: npm_config_cache名称: npm_config_cache
  • value: /tmp/empty-cache值:/tmp/空缓存

More information concerning npm-config .有关npm-config 的更多信息。

  1. npm uninstall -g @angular/cli
  2. npm cache clean --force
  3. npm install -g @angular/cli

那么它现在应该可以工作了,

ng new my-app

在使用 angular cli 当前版本之前,始终更新到 Nodejs 的最新LTS版本。

as a temporary fix you can manually install "error-ex" module directly from GitHub then install your dependencies as mentioned here facebook/create-react-app#8465 (comment)作为临时修复,您可以直接从 GitHub 手动安装“error-ex”模块,然后按照此处所述安装您的依赖项 facebook/create-react-app#8465(评论)

$ npm i https://github.com/Qix-/node-error-ex $ npm i https://github.com/Qix-/node-error-ex

$ npm i $ npm i

我遇到了这个问题,然后我导航到文件.angular-config path C:\\Users\\username并更改"packageManager" : "npm"

{ "version": 1, "cli": { "analytics": "_________", "packageManager": "npm" } }

I had the same problem, after a lot of search and two day of trying many ways, I finally solved my problem by installing codelyzer.我遇到了同样的问题,经过大量搜索和两天尝试多种方法后,我终于通过安装 codelyzer 解决了我的问题。 first run this command in cmd:首先在cmd中运行这个命令:

npm install -g codelyzer

then run:然后运行:

ng new yourProject

This must work because I had a similar problem这必须有效,因为我有类似的问题

  1. npm install -g @angulat/cli
  2. npm install mkdirp
  3. npm cache verify
  4. close terminal and open again关闭终端并再次打开
  5. ng new your project name

if it doesn't work, turn your firewall off and do them again.如果它不起作用,请关闭防火墙并再次执行。 I bet it will work.我打赌它会起作用。

我遇到了同样的问题,这个命令解决了我的问题:

ng config -g cli.packageManager yarn

Follow this way to solve this issue按照这个方法解决这个问题

  1. Open a new terminal and run node -v and then npm -v to make sure you are running compatible versions: "Node 8.9 or higher, together with NPM 5.5.1 or higher"打开一个新终端并运行node -v然后npm -v以确保您运行的是兼容版本:“Node 8.9 或更高版本,以及 NPM 5.5.1 或更高版本”
  2. Uninstall your current Global Angular cli npm uninstall -g @angular/cli卸载当前的 Global Angular cli npm uninstall -g @angular/cli
  3. Run npm cache verify运行npm cache verify
  4. Re-Install Angular CLI npm install -g @angular/cli@latest重新安装 Angular CLI npm install -g @angular/cli@latest
  5. Close your terminal window.关闭终端窗口。
  6. Open a new terminal window, browse to where you want your new project and try the 'ng new` command again.打开一个新的终端窗口,浏览到您想要新项目的位置,然后再次尝试“ng new”命令。

This issue arises mostly because of the npm cache still keeping this error.这个问题的出现主要是因为 npm 缓存仍然保持这个错误。 All you need to do is to force clean the npm cache and try creating your app again.您需要做的就是强制清理 npm 缓存并再次尝试创建您的应用程序。

npm cache clean --force
ng new myapp

I got the same error.我得到了同样的错误。 Before you reinstall the Angular CLI you have to check your internet connection and its speed.在重新安装 Angular CLI 之前,您必须检查您的互联网连接及其速度。 In my case, the error has occurred because my internet connection was interrupting.就我而言,发生错误是因为我的互联网连接中断。 I could resolve that issue after I fixed my connection issue.修复连接问题后,我可以解决该问题。

Ensure cli is in a small case and package looks like @angular/cli during installation.确保cli在一个小案例中,并且在安装过程中包看起来像@angular/cli I have followed this in some tutorial to solve this issue.我在一些教程中遵循了这个来解决这个问题。

Please install new node js updated version and angular CLI as well.请安装新的 node js 更新版本和 angular CLI。 will surely solve your problem.一定会解决你的问题。

  1. npm cache clean --force npm 缓存清理 --force

  2. ng new my-app --skip-install ng new my-app --skip-install

  3. cd my-app cd 我的应用程序

  4. npm i我的

  5. ng serve服务

I got this error when updating npm to 7.xxnpm更新到7.xx时出现此错误

So if you want to use angular12 based on angular-cli-node-js-typescript-compatiblity-matrix version of node and npm should be like this :所以,如果你想使用angular12基于角CLI-节点JS-打字稿,兼容性矩阵节点和故宫的版本应该是这样的:

node : 12.13.x - 14.15.x npm : 6.xx - 7节点: 12.13.x - 14.15.x npm: 6.xx - 7

I used nvm for mange version of node我使用nvm管理节点的版本

I had a similar problem, which I solved like this:我有一个类似的问题,我是这样解决的:

npm install -g npm@latest
npm cache clean --force
ng new project-name

I followed this link and got my issue resolved.我按照此链接解决了我的问题。

You can also follow this link .您也可以点击此链接 This also resolves the issue.这也解决了这个问题。

in the short first link says:在简短的第一个链接中说:

npm cache clean --force npm i -g @angular/cli

the second link says:第二个链接说:

ng new angular --skip-install cd angular npm i ng serve

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM