Home > database >  Property left of ForInStatement expected node to be of a type ["VariableDeclaration","
Property left of ForInStatement expected node to be of a type ["VariableDeclaration","

Time:12-27

I have a big problem. We use angular.js application and maven to build our application.Previosly everyhing worked when we build our application with bower.json.

And from yesterday we got this error

Warning: /builds/t2i/xecm/xecm-webapp/src/main/webapp/services/document-service.js: Property left of ForInStatement expected node to be of a type ["VariableDeclaration","LVal"] but instead got undefined Use --force to continue. Property left of ForInStatement expected node to be of a type ["VariableDeclaration","LVal"] but instead got undefined Use --force to continue.

when we build our application.

I searched on google for this issue and I found out that it is somehow related to the version of babel. But I don't get it how it worked previosly and now it does not work.

I checked and I am 100% sure that we did not changed ANY dependency, not just for babel but and also for other dependencies.

In the file document-service.js where the problem occurs, we did not maked any changes also. The last change there was 2 months ago and in this 2 months everything worked and the build was passing.

What could be the issue ? I never experienced some strange issue like this and I really don't know what should I do,what should I check to find where is the problem and how can I solve this...

This is how my bower.json looks like


{
    "name": "${project.artifactId}",
    "version": "{project.version}",
    "homepage": "https://example.com/",
    "appPath": "webapp",
    "main": ["./${project.artifactId}.js"],
    "private": true,
    "dependencies": {
        "json3": "~3.2.6",
        "angular-resource": "1.6.4",
        "angular-cookies": "1.6.4",
        "angular-route": "1.6.4",
        "angular-animate": "1.6.4",
        "angular-sanitize": "1.6.4",
        "angular-touch": "1.6.4",
        "angular-gestures": "0.3.1",
        "angular-spinner": "1.0.1",
        "angular-css-injector": "1.4.0",
        "angular-truncate": "*",
        "angular-dynamic-locale": "~0.1.32",
        "angular-once": "~0.1.8",
        "angular-capitalize-filter": "~3.0.0",
        "angular-ui-router": "1.0.5",
        "xcomponent-widgets": "${project.build.directory}/${bower.components.dir}/xcomponent-widgets",
        "angular": "1.6.4",
        "ng-img-crop": "0.3.2",
        "angular-bootstrap-switch": "0.5.2",
        "angular-toastr": "2.1.1",
        "angular-moment": "1.0.1",
        "moment-timezone": "0.5.13",
        "moment": "2.15.2",  
        "ng-focus-if": "1.0.5",
        "ng-file-upload": "12.2.3",
        "ng-device-detector": "4.0.3",
        "textAngular":"1.5.16",        
        "angular-base64":"2.0.4",
        "jspdf":"1.3.2",
        "angular-clipboard":"1.5.0",
        "ngclipboard":"1.1.1",
        "angular-swx-session-storage":"1.0.2",
        "angular-cache":"4.6.0",
        "angular-highlightjs":"0.4.0",
        "angularjs-slider": "6.4.3",
        "angular-ui-select": "0.19.8",
        "angular-bootstrap":"2.5.0"
    },
    "overrides": {
        "bootstrap": {
            "main": [
                "less/bootstrap.less",
                "dist/css/bootstrap.css",
                "dist/js/bootstrap.js"
            ]
        }
    },
    "devDependencies": {
        "angular-mocks": "1.6.4",
        "angular-scenario": "1.6.4",
        "bootstrap": "~3.1.1"
    },
    "resolutions": {
        "angular": "1.6.4",
        "jquery": ">=1.9.0",
        "bootstrap": "~3.1.1",
        "moment": "2.15.2",
        "ng-file-upload": "10.1.5"
    }

}

We also use grunt and this is how the babel configurations looks like inside gruntfile-dev.js

  babel: {
            options: {
                sourceMap: true,
                presets: ['@babel/preset-env'],
                sourceType: 'module'
            },
            dev: {
                files: [{
                    expand: true,
                    dot: true,
                    cwd: '<%= yeoman.sources %>',
                    dest: '<%= yeoman.dev %>',
                    src: [
                        '**/*.js'
                    ]
                }]
            }
        },

CodePudding user response:

Check your code on "for" loops which have "var" variable initialization and replace it with "let". In my case it resolved the issue.

  • Related