12

Can you help me out with this error? this my package.json error I keep getting this error:

ERROR in node_modules/ngx-daterangepicker-material/daterangepicker.component.d.ts(59,9): error TS1086: An accessor cannot be declared in an ambient context.

 "@agm/core": "^1.0.0-beta.7", "@angular/animations": "~8.0.3", "@angular/cdk": "^8.1.1", "@angular/common": "~8.0.3", "@angular/compiler": "~8.0.3", "@angular/core": "~8.0.3", "@angular/forms": "~8.0.3", "@angular/material": "^8.1.1", "@angular/material-moment-adapter": "^8.1.1", "@angular/platform-browser": "~8.0.3", "@angular/platform-browser-dynamic": "~8.0.3", "@angular/router": "~8.0.3", "@fortawesome/angular-fontawesome": "^0.4.0", "@fortawesome/fontawesome-svg-core": "^1.2.28", "@fortawesome/free-solid-svg-icons": "^5.13.0", "@syncfusion/ej2-angular-calendars": "^17.4.51", "@types/jquery": "^3.3.35", "acorn": "^6.4.1", "angular-hammer": "^2.2.0", "angular-svg-icon": "^8.0.0", "bootstrap": "^4.3.1", "mat-range-datepicker": "^1.0.5", "moment": "^2.24.0", "ng2-datepicker": "^2.3.1", "ng2-tooltip-directive": "^2.9.20", "ngx-daterangepicker-material": "^2.2.1", "ngx-drag-scroll": "^8.0.0-beta.2", "ngx-infinite-scroll": "^8.0.2", "ngx-material-timepicker": "^5.5.1", "popper.js": "^1.15.0", "pretty-checkbox": "^3.0.3", "rxjs": "~6.4.0", "tslib": "^1.11.1", "xlsx": "^0.15.6", "zone.js": "~0.9.1" }, "devDependencies": { "@angular-devkit/build-angular": "~0.800.6", "@angular/cli": "~8.0.6", "@angular/compiler-cli": "~8.0.3", "@angular/language-service": "~8.0.3", "@types/jasmine": "~3.3.8", "@types/jasminewd2": "~2.0.3", "@types/node": "~8.9.4", "codelyzer": "^5.2.2", "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.5.3", "protractor": "~5.4.0", "ts-node": "~7.0.0", "tslint": "~5.15.0", "typescript": "~3.4.3" } `` thank you 
1
  • I am getting same issue when I install ngx-chips for Tag npm. Now I can not also compile and getting same issue Commented Apr 16, 2020 at 10:52

8 Answers 8

17

For metronic-angular 6.1.8, I spent 8 hours, but I solved.

  • removed package-lock.json
  • removed node_modules folder
  • npm install

if you execute ng serve received TS1086 error, don't worry...

now launch:

relaunch `ng serve enjoy! ;)

the first solution solved the development part, but there are problems during the deployment. The final solution is:

  • removed package-lock.json
  • removed node_modules folder
  • in package.json remove (^) on library ngx-daterangepicker-material ("ngx-daterangepicker-material": "^2.1.11" -> "ngx-daterangepicker-material": "2.1.11")
  • increase version moment from ^2.24.0 to 2.25.3 (remove ^, "moment": "^2.24.0" -> "moment": "2.25.3",

Now working all... both ng serve and yarn build. ;)

Sign up to request clarification or add additional context in comments.

3 Comments

I cannot believe that the answer I was looking for is from you Pasquale! It's incredible to meet here on a randomly choosen answer on stackoverflow! Anyway it worked for me, thanks a lot and hope to hear from you soon!
This answer saves me from hours and hours and hours of searching!
Thank you bro, I've spent like 4 days trying to figure out why I get maximum call stack size exceeded on ng serve, whenever I made changes to my project. Turns out it was the "ngx-daterangepicker-material" library lol
10

I solved the issue by following 2 steps

  1. First remove "ngx-daterangepicker-material": "^2.2.1" from package.json

  2. Run npm i [email protected]

  3. "ng serve"

It will compile successfully

Comments

2

I have just solved the issue by following steps

  1. First, remove the node_modules folder from your project folder

  2. In your package.json replace above version for ngx-daterangepicker-material from 2.2.1 to 2.1.9, like

remove -> "ngx-daterangepicker-material": "^2.2.1",

add -> "ngx-daterangepicker-material": "^2.1.9",

  1. Run npm install command in terminal and then compile

It will compile successfully

1 Comment

Weird that this solves the issue. For me this actually solved this issue as well but I can not explain how...
1

To resolve this issue, we will have to check the angular version used in your project. Based on the angular version we have to update the ngx-daterangepicker-material libray in the package.json.

Check the below to find suitable library version for your angular project:

Versions:

Angular ngx-daterangepicker-material >=9.0.0 v2.3.x and v3.x <9.0.0 v2.2.x and below 

Reference: https://www.npmjs.com/package/ngx-daterangepicker-material

Run the below comment for prod build if you face javascript heap out of memory issue in normal "ng --prod":

node --max_old_space_size=8192 node_modules/@angular/cli/bin/ng build client --prod 

3 Comments

change the version but the problem persist
Please do "npm install" once done with package.json changes and check if the angular version is less than 9 use the "ngx-daterangepicker-material" version 2.2.0 and check with the build command.
the answer for solve my problem it´s up, in the explication pasquale carucci. Thanks
0

Hi i have the same problem, but i try change version, but doesn't work

{ "name": "metronic-angular", "version": "6.1.8", "description": "Packages used by Angular", "scripts": { "ng": "ng", "start": "node --max_old_space_size=8192 node_modules/@angular/cli/bin/ng serve", "build": "ng build --prod", "test": "ng test", "lint": "ng lint", "e2e": "ng e2e", "bundle-report": "webpack-bundle-analyzer dist/stats.json", "rtl": "webpack" }, "private": true, "dependencies": { "@angular/animations": "^8.2.14", "@angular/cdk": "^8.2.3", "@angular/common": "^8.2.14", "@angular/compiler": "^8.2.14", "@angular/core": "^8.2.14", "@angular/forms": "^8.2.14", "@angular/platform-browser": "^8.2.14", "@angular/platform-browser-dynamic": "^8.2.14", "@angular/platform-server": "^8.2.14", "@angular/router": "^8.2.14", "@fortawesome/fontawesome-free": "^5.12.0", "@ng-bootstrap/ng-bootstrap": "^5.1.5", "@ngrx/effects": "^8.6.0", "@ngrx/entity": "^8.6.0", "@ngrx/router-store": "^8.6.0", "@ngrx/store": "^8.6.0", "@ngrx/store-devtools": "^8.6.0", "@ngx-loading-bar/core": "^4.2.0", "@ngx-translate/core": "^11.0.1", "@types/lodash": "^4.14.149", "angular-in-memory-web-api": "^0.8.0", "bootstrap": "^4.4.1", "chart.js": "^2.9.3", "chartist": "^0.11.4", "classlist.js": "^1.1.20150312", "core-js": "^3.6.2", "hammerjs": "^2.0.8", "highlight.js": "^9.17.1", "lodash": "^4.17.11", "material-design-icons": "^3.0.1", "moment": "^2.24.0", "ng-inline-svg": "^9.2.2", "ngrx-store-freeze": "^0.2.4", "ngx-clipboard": "^12.3.0", "ngx-daterangepicker-material": "^2.11.1", // change version but the problem persist "ngx-highlightjs": "^3.0.3", "ngx-perfect-scrollbar": "^8.0.0", "ngx-permissions": "^7.0.3", "object-path": "^0.11.4", "perfect-scrollbar": "^1.4.0", "popper.js": "^1.16.0", "rxjs": "^6.5.4", "socicon": "^3.0.5", "tooltip.js": "^1.3.3", "tslib": "^1.10.0", "web-animations-js": "^2.3.2", "zone.js": "~0.9.1" }, "devDependencies": { "@angular-devkit/build-angular": "^0.800.6", "@angular/cli": "^8.3.22", "@angular/compiler-cli": "^8.2.14", "@angular/language-service": "^8.2.14", "@angular/material": "^8.2.3", "@angular/material-moment-adapter": "^8.2.3", "@ngrx/schematics": "^8.6.0", "@types/chartist": "^0.9.46", "@types/highlight.js": "^9.12.3", "@types/jasmine": "^3.5.0", "@types/jasminewd2": "^2.0.8", "@types/node": "^12.12.24", "@types/object-path": "^0.11.0", "codelyzer": "^5.2.1", "css-loader": "^3.4.1", "jasmine-core": "~3.4.0", "jasmine-spec-reporter": "~4.2.1", "karma": "^4.4.1", "karma-chrome-launcher": "~2.2.0", "karma-coverage-istanbul-reporter": "^2.1.1", "karma-jasmine": "~2.0.1", "karma-jasmine-html-reporter": "^1.5.1", "node-sass": "^4.13.0", "protractor": "~5.4.2", "ts-node": "~8.2.0", "tslint": "~5.17.0", "typescript": "~3.4.5", "webpack-bundle-analyzer": "^3.6.0", "webpack-cli": "^3.3.10", "webpack-messages": "^2.0.4", "webpack-rtl-plugin": "^2.0.0" } 

}

Comments

0

I tried all the proposed solutions above, they didn't solve the issue for me. However, I solved this issue by simply changing the package version:

"ngx-daterangepicker-material": "2.1.9"

Then - removing node_modules folder - npm install - ng serve works - ng build --prod --aot=true also works

Comments

0
  1. First remove "ngx-daterangepicker-material": "^2.2.1" from package.json

  2. Run "npm i [email protected]"

Comments

0

First remove "ngx-daterangepicker-material": "^2.2.1" from package.json

Run "ngx-daterangepicker-material": "2.2.0"

If there is this sign ^ please uninstall it then try again npm install. ^ this mark upper version install

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.