简体   繁体   English

无法加载架构 -- angular.json 文件

[英]Unable to load Schema -- angular.json file

I am getting below error in angular.json file, where schema is not loading properly, getting error unable to load schema, first line of below code giving me error, see below我在angular.json文件中遇到以下错误,其中架构未正确加载,出现无法加载架构的错误,下面代码的第一行给我错误,见下文

{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "version": 1,
  "newProjectRoot": "projects",
  "projects": {
    "mrr": {
      "root": "",
      "sourceRoot": "src",
      "projectType": "application",
      "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {

both angular.json and node_modules is in the same level. angular.jsonnode_modules都处于同一级别。

Hi Abhishek is a problem related to Angular 9 or Node 12 i had the same issue i had the same issue so i rollback to node 11 and angular 8 and everything is fine嗨,Abhishek 是与 Angular 9 或节点 12 相关的问题,我遇到了同样的问题,我遇到了同样的问题,所以我回滚到节点 11 和 angular 8,一切都很好

[Update] i update angular and node and everything is fine the problem is solved in 9.1.6 you can check the issue on github https://github.com/angular/angular/issues/35154 [更新] 我更新了角度和节点,一切都很好问题在 9.1.6 中得到解决,您可以在 github https://github.com/angular/angular/issues/35154上查看问题

Steps i follow我遵循的步骤

  • npm cache clean
  • npm install -g @angular/cli

If you are having trouble with npm install, use the -verbose option to see more details.如果您在使用 npm install 时遇到问题,请使用 -verbose 选项查看更多详细信息。

  • after all of this ng update在所有这些ng update之后

This will fix this error.这将修复此错误。

I got this in VSCode when I accidentally started it without first running "npm install" in an Angular project after restructuring my work directory and wiping out some node_modules directories in the process to avoid time-consuming copy operations.我在 VSCode 中得到了这个,当我在重组我的工作目录并在过程中清除一些 node_modules 目录以避免耗时的复制操作之后,在 Angular 项目中没有先运行“npm install”而意外启动它。

Naturally, when I got the error I didn't even bother to check if node_modules was there, I "just knew" that it was.自然,当我收到错误时,我什至都懒得检查 node_modules 是否存在,我“只知道”它存在。 (I had in fact already run "npm install" in all but that one project directory.) (事实上​​,我已经在除了那个项目目录之外的所有目录中运行了“npm install”。)

After closing VSCode, running "npm install" in the Angular project directory and starting VSCode again, the error went away.关闭 VSCode 后,在 Angular 项目目录中运行“npm install”并再次启动 VSCode,错误消失了。

Open your project in file explorer, then close VS Code.在文件资源管理器中打开您的项目,然后关闭 VS Code。 In your project delete the 'node_modules' folder.在您的项目中删除“node_modules”文件夹。 Next open VS Code again run npm install command in your terminal.接下来打开 VS Code 再次在终端中运行 npm install 命令。 All the modules will be installed again and the issued should be gone now.所有模块都将重新安装,现在发布的应该已经消失了。

I fixed it by deleting my npm catch folder and reinstalling Angular CLI.我通过删除我的 npm catch 文件夹并重新安装 Angular CLI 来修复它。

以管理员身份打开 IDE 或为根文件夹上的用户提供完全访问权限

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

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