Every time I try installing any package or even if I try doing npm install
I keep getting this error. I have no idea why I am getting the error. I am totally new to Angular 4, it's only been a week, so any any leads will be appreciated. I am using node -v 8.8.1 and @angular/cli 1.4.9.
This is my package.json.
{ "name": "events-across", "version": "0.0.0", "license": "MIT", "scripts": { "ng": "ng", "start": "ng serve", "build": "ng build", "test": "ng test", "lint": "ng lint", "e2e": "ng e2e" }, "private": true, "dependencies": { "@angular/animations": "^4.2.4", "@angular/common": "^4.2.4", "@angular/compiler": "^4.2.4", "@angular/core": "^4.2.4", "@angular/forms": "^4.2.4", "@angular/http": "^4.2.4", "@angular/platform-browser": "^4.2.4", "@angular/platform-browser-dynamic": "^4.2.4", "@angular/router": "^4.2.4", "angular-font-awesome": "^2.3.7", "angular4-carousel": "^3.1.8", "bootstrap": "^4.0.0-beta", "core-js": "^2.4.1", "font-awesome": "^4.7.0", "ng2-opd-popup": "^1.1.21", "rxjs": "^5.4.2", "zone.js": "^0.8.14" }, "devDependencies": { "@angular/cli": "1.4.9", "@angular/compiler-cli": "^4.2.4", "@angular/language-service": "^4.2.4", "@types/jasmine": "~2.5.53", "@types/jasminewd2": "~2.0.2", "@types/node": "~6.0.60", "codelyzer": "~3.2.0", "jasmine-core": "~2.6.2", "jasmine-spec-reporter": "~4.1.0", "karma": "~1.7.0", "karma-chrome-launcher": "~2.1.1", "karma-cli": "~1.0.1", "karma-coverage-istanbul-reporter": "^1.2.1", "karma-jasmine": "~1.1.0", "karma-jasmine-html-reporter": "^0.2.2", "protractor": "~5.1.2", "ts-node": "~3.2.0", "tslint": "~5.7.0", "typescript": "~2.3.3" } }
Run npm install again. Your package.json, or maybe other JSON file is incorrect. You must first fix JSON errors. SyntaxError: Unexpected token '?' rm -rf node_modules rm package-lock.json npm cache verify npm install Deleting Node Modules and package-lock JSON file, solves this issue in many cases. Delete the node_modules folder.
That unexpected token, <, is a strong clue that the response was HTML instead of JSON. The root cause is that the server returned HTML or some other non-JSON string. Why would it do that? “Unexpected token o in JSON at position 1” and other varieties
You must first fix JSON errors. SyntaxError: Unexpected token '?' rm -rf node_modules rm package-lock.json npm cache verify npm install Deleting Node Modules and package-lock JSON file, solves this issue in many cases. Delete the node_modules folder. Delete package-lock.json file. Run npm install again.
The token and the position may vary, but the root cause is the same: the text that your app is trying to parse as JSON is not actually valid JSON. Here are some other variations I’ve seen…. Unexpected token < in JSON at position 1. Unexpected token p in JSON at position 0. Unexpected token d in JSON at position 0.
try to remove package.lock file
Possible issue here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With