Ошибка data path

I’m trying to run either ‘ng serve’ or ‘npm start’ to run my angular 8 server on localhost:4200 in cmd on a windows machine. I get a Schema error I think I know where the problem is but no idea how to fix it.

Another point to note is this was working perfectly fine until windows restarted my computer to do an update.

I’m also running tailwind through a webpack.

The main part of the error is: Data path «» should have required property ‘browserTarget’

"serve": {
   "builder": "@angular-builders/custom-webpack:dev-server",
   "options": {
      "customWebpackConfig": {
         "path": "./webpack.config.js"
       }
   }
},

I assume I need to add browserTarget in the options here, when I do that I get an error saying I need main in there too.

Am I on the right track?
If I am, what are the values that should be attributed to these properties?

Any help would be greatly appreciated.

I’ve tried:

  • Upgrading my packages.

  • Upgrading Angular

  • Deleting the node modules folder and npm installing

angular.json:


    {
      "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
      "version": 1,
      "newProjectRoot": "projects",
      "projects": {
        "bjjcastle": {
          "projectType": "application",
          "schematics": {
            "@schematics/angular:component": {
              "style": "scss"
            }
          },
          "root": "",
          "sourceRoot": "src",
          "prefix": "app",
          "architect": {
            "build": {
              "builder": "@angular-builders/custom-webpack:browser",
              "options": {
                "customWebpackConfig": {
                  "path": "./webpack.config.js"
                }
              }
            },
            "serve": {
              "builder": "@angular-builders/custom-webpack:dev-server",
              "options": {
                "customWebpackConfig": {
                  "path": "./webpack.config.js"
                }
              }
            },
            "extract-i18n": {
              "builder": "@angular-devkit/build-angular:extract-i18n",
              "options": {
                "browserTarget": "bjjcastle:build"
              }
            },
            "test": {
              "builder": "@angular-devkit/build-angular:karma",
              "options": {
                "main": "src/test.ts",
                "polyfills": "src/polyfills.ts",
                "tsConfig": "tsconfig.spec.json",
                "karmaConfig": "karma.conf.js",
                "assets": [
                  "src/favicon.ico",
                  "src/assets"
                ],
                "styles": [
                  "src/styles.scss",
                  "node_modules/font-awesome/scss/font-awesome.scss"
                ],
                "scripts": []
              }
            },
            "lint": {
              "builder": "@angular-devkit/build-angular:tslint",
              "options": {
                "tsConfig": [
                  "tsconfig.app.json",
                  "tsconfig.spec.json",
                  "e2e/tsconfig.json"
                ],
                "exclude": [
                  "**/node_modules/**"
                ]
              }
            },
            "e2e": {
              "builder": "@angular-devkit/build-angular:protractor",
              "options": {
                "protractorConfig": "e2e/protractor.conf.js",
                "devServerTarget": "bjjcastle:serve"
              },
              "configurations": {
                "production": {
                  "devServerTarget": "bjjcastle:serve:production"
                }
              }
            }
          }
        }},
      "defaultProject": "bjjcastle"
    }

package.json:


    {
      "name": "bjjcastle",
      "version": "0.0.0",
      "scripts": {
        "ng": "ng",
        "start": "ng serve",
        "build": "ng build",
        "test": "ng test",
        "lint": "ng lint",
        "e2e": "ng e2e"
      },
      "private": true,
      "dependencies": {
        "@angular/animations": "~8.2.2",
        "@angular/common": "~8.2.2",
        "@angular/compiler": "~8.2.2",
        "@angular/core": "~8.2.2",
        "@angular/forms": "~8.2.2",
        "@angular/platform-browser": "~8.2.2",
        "@angular/platform-browser-dynamic": "~8.2.2",
        "@angular/router": "~8.2.2",
        "@fortawesome/angular-fontawesome": "^0.5.0",
        "@fortawesome/fontawesome-svg-core": "^1.2.21",
        "@fortawesome/free-brands-svg-icons": "^5.10.1",
        "@fortawesome/free-solid-svg-icons": "^5.10.1",
        "rxjs": "~6.5.2",
        "tslib": "^1.10.0",
        "zone.js": "~0.9.1"
      },
      "devDependencies": {
        "@angular-builders/custom-webpack": "^8.1.0",
        "@angular-devkit/build-angular": "~0.802.2",
        "@angular/cli": "~8.2.2",
        "@angular/compiler-cli": "~8.2.2",
        "@angular/language-service": "~8.2.2",
        "@types/jasmine": "~3.3.8",
        "@types/jasminewd2": "~2.0.3",
        "@types/node": "~8.9.4",
        "codelyzer": "^5.0.0",
        "jasmine-core": "~3.4.0",
        "jasmine-spec-reporter": "~4.2.1",
        "karma": "~4.1.0",
        "karma-chrome-launcher": "~2.2.0",
        "karma-coverage-istanbul-reporter": "~2.0.1",
        "karma-jasmine": "~2.0.1",
        "karma-jasmine-html-reporter": "^1.4.0",
        "postcss-import": "^12.0.1",
        "postcss-loader": "^3.0.0",
        "postcss-scss": "^2.0.0",
        "protractor": "~5.4.0",
        "tailwindcss": "^1.1.1",
        "ts-node": "~7.0.0",
        "tslint": "~5.15.0",
        "typescript": "~3.5.3"
      }
    }

webpack.config.js:


    module.exports = {
        module : {
          rules: [
            {
              test   : /\.scss$/,
              loader : 'postcss-loader',
              options: {
                ident  : 'postcss',
                syntax: 'postcss-scss',
                plugins: () => [
                  require('postcss-import'),
                  require('tailwindcss'),
                  require('autoprefixer'),
                ]
              }
            }
          ]
        }
      };

The Error I receive:

    Schema validation failed with the following errors:

      Data path "" should have required property 'browserTarget'.

    npm ERR! code ELIFECYCLE

    npm ERR! errno 1

    npm ERR! bjjcastle@0.0.0 start: `ng serve`

    npm ERR! Exit status 1


    npm ERR!

    npm ERR! Failed at the bjjcastle@0.0.0 start script.

    npm ERR! This is probably not a problem with npm. There is likely additional 
    logging output above.

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

    npm ERR!     C:\Users\MyRoute\AppData\Roaming\npm-cache\_logs\2019-08-16T05_27_51_621Z-debug.log

When you face an issue while upgrading your project from angular low version to angular new version.

After a successful upgrade, while preparing a build, it gives the following error.

   Schema validation failed with the following errors:

  Data path «should NOT have additional properties(extracts).

Answer

Option 1.

Just remove the «extractCss»: true from your production environment, it will resolve the problem.

The reason for it is extractCss is deprecated, and its value is true by default.

Option 2.

Getting error “extractCss is deprecated” comes because it has default value as true now. extractCss can be safely removed from angular.json or during the upgrade schematics should do it for you. This means that you don’t use styles.js anymore during the application build. The migration schematic should remove unused properties or replace them with the new alternative once you do the upgrade.

Option 3.

Try to change it

 "schematics": {

    "@schematics/angular:component": {
      "styleext": "scss"
    }
  },

to 

  "schematics": {

    "@schematics/angular:component": {
      "style": "scss"
    }
  },

Option 4.

we edit the angulaer.json file (most likely located at the root of your project) and look for the schematics object. Remove the property styleext: «css» because it is not a valid property for your project.

Option 5.

In your angular.json

"schematics": {

    "@schematics/angular:component": {
      "style": "scss"
    },
    "@schematics/angular:application": {
      "strict": true
    }
  },

Option 6.

This error message typically appears when you are using the extractCss option in the Angular CLI and there is an error in your configuration.

The extractCss option allows you to extract the CSS from your application into a separate file, which can improve the performance of your application by reducing the size of the JavaScript bundle and allowing the browser to cache the CSS separately.

To use the extractCss option, you need to specify it in the angular.json file in the build or test options for your project:

{
  "projects": {
    "my-project": {
      "architect": {
        "build": {
          "options": {
            "extractCss": true
          }
        },         "test": {
          "options": {
            "extractCss": true
          }
        }
      }
    }
  }
}

If you are seeing the «Data path must NOT have additional properties(extractCss)» error message, it means that there is an error in your angular.json file, such as an extra comma or an invalid value for the extractCss option.

To fix the error, you will need to check the angular.json file for any syntax errors and ensure that the extractCss option is properly configured.

I hope this helps! Let me know if you have any other questions about the «Data path must NOT have additional properties(extractCss)» error message in Angular.

If you have faced or are facing the below error while running your angular application, then this post is for you.

Schema validation failed with the following errors: Data path “” should NOT have additional properties(es5BrowserSupport)

Solution
There are two ways to remove this error, choose any of the below as per the requirement.
1. Remove es5BrowserSupport option from application
Find angular.json file in your project and search for es5BrowserSupport. Comment this line as shown in the image below.
comment out es5browsersupport property
Restart the application using command ng serve.
This approach is not recommended if you want your application to support older browsers.

2. Upgrade versions to support es5BrowserSupport
If you want es5BrowserSupport in your application, then the minimum version for @angular/cli should be 7.3 and @angular-devkit/build-angular should be 0.13.
So, modify the version of these dependencies in the package.json file of your application. After these modifications, run npm install to install the updates and run ng serve to start the application.
Further, if you do not want to edit package.json file, then update @angular/cli using below command,

ng update @angular/cli

and update @angular-devkit/build-angular using below command

ng update @angular-devkit/build-angular

Hit the clap below if any of the above solutions worked for you.

Starting the game Rise and Fall: Civilizations at War may cause an error message on Windows 7, Windows 10 or newer, saying:

Unable to locate file, the data path appears to be incorrect, please check your data path

We may fix this by creating a file “runme.bat” (without quotes) in the game’s installation directory. Let’s put the following contents in that file:

RiseAndFall.exe -datapath "Data\" -redistpath "redist\" -nodump

Save the file runme.bat and double click on it. Afterwards the game should work fine again.

Alternatively, we might was well create a (desktop) shortcut to the RiseAndFall.exe and apply the -datapath parameters from the text above to it in our target. Example (obviously you’ll have to apply the path to your installation directory):

"C:\GAMES\Rise and Fall\RiseAndFall.exe" -datapath "Data\" -redistpath "redist\" -nodump

I do: no error when only using
"start": "ng serve",
in my package.json.

The error appears when I start the same project with parameter
"start": "ng serve -p 4201",
(no matter which port No.). Didn’t try other params.

In all former setups/versions I never had this problem.
Looks like at least the existence of parameters in ng-serve causes the problem.

But, when I use --port 4201 instead of -p 4201, the error disappears again. Presumably some syntax change by the developers or abbreviations are not parsed correctly anymore.

Here’s my environment:
Windows 7, in PhpStorm 2017.3 shell and MINGW64
package.json which produces the error:

 "name": "...",
  "version": "0.0.2",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "lint": "ng lint",
    "pree2e": "webdriver-manager update --standalone false --gecko false --quiet",
    "build": "ng build",
    "start": "ng serve -p 4201",
    "test": "ng test",
    "e2e": "ng e2e",
    "doc": "ng doc"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^6.0.0-rc.0",
    "@angular/cdk": "github:angular/cdk-builds",
    "@angular/common": "^6.0.0-rc.0",
    "@angular/compiler": "^6.0.0-rc.0",
    "@angular/core": "^6.0.0-rc.0",
    "@angular/forms": "^6.0.0-rc.0",
    "@angular/http": "^6.0.0-rc.0",
    "@angular/material": "github:angular/material2-builds",
    "@angular/platform-browser": "^6.0.0-rc.0",
    "@angular/platform-browser-dynamic": "^6.0.0-rc.0",
    "@angular/router": "^6.0.0-rc.0",
    "core-js": "^2.5.3",
    "rxjs": "^5.6.0-forward-compat.0 || ^6.0.0-alpha.4",
    "zone.js": "^0.8.20"
  },
  "devDependencies": {
    "rxjs-compat": "^6.0.0-beta.1",
    "@angular/cli": "^6.0.0-beta.6",
    "@angular/compiler-cli": "^6.0.0-rc.0",
    "@angular/language-service": "^6.0.0-rc.0",
    "@types/jasmine": "^2.8.6",
    "@types/jasminewd2": "^2.0.3",
    "@types/node": "^9.4.7",
    "autoprefixer": "^8.1.0",
    "circular-dependency-plugin": "^4.4.0",
    "codelyzer": "^4.2.1",
    "css-loader": "^0.28.11",
    "cssnano": "^3.10.0",
    "exports-loader": "^0.7.0",
    "file-loader": "^1.1.11",
    "html-webpack-plugin": "^3.0.7",
    "istanbul-instrumenter-loader": "^3.0.0",
    "jasmine-core": "~3.1.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "^2.0.0",
    "karma-chrome-launcher": "~2.2.0",
    "karma-cli": "~1.0.1",
    "karma-coverage-istanbul-reporter": "^1.4.2",
    "karma-jasmine": "^1.1.1",
    "karma-jasmine-html-reporter": "^0.2.2",
    "less-loader": "^4.1.0",
    "postcss-loader": "^2.1.3",
    "postcss-url": "^7.3.1",
    "protractor": "~5.3.0",
    "raw-loader": "^0.5.1",
    "sass-loader": "^6.0.7",
    "script-loader": "^0.7.2",
    "source-map-loader": "^0.2.3",
    "style-loader": "^0.20.3",
    "stylus-loader": "^3.0.2",
    "ts-node": "~5.0.1",
    "tslint": "~5.9.1",
    "typescript": "^2.7.2",
    "url-loader": "^1.0.1",
    "webpack": "~4.2.0",
    "webpack-dev-server": "^3.1.1"
  },
  "main": "index.js",
  "repository": "...",
  "author": "..."
}

Понравилась статья? Поделить с друзьями:
  • Ошибка debootstrap astra linux
  • Ошибка data bin не найден при установке игры
  • Ошибка death stranding windows 10
  • Ошибка dasd сервер ibm
  • Ошибка daf 4186