Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Receiving NPM err: Unexpected string in JSON at position 20938 within an ionic 3 project

Not sure where the error is. (* is where private project information is held, i.e. Facebook app id and the app name) I have been receiving this error for a while now and I can't figure it out, is there something I'm missing?

{
    "name": "****",
    "version": "0.0.1",
    "author": "Ionic Framework",
    "homepage": "http://ionicframework.com/",
    "private": true,
    "scripts": {
        "clean": "ionic-app-scripts clean",
        "build": "ionic-app-scripts build",
        "lint": "ionic-app-scripts lint",
        "ionic:build": "ionic-app-scripts build",
        "ionic:serve": "ionic-app-scripts serve"
    },
    "dependencies": {
        "@angular/common": "4.4.3",
        "@angular/compiler": "4.4.3",
        "@angular/compiler-cli": "4.4.3",
        "@angular/core": "4.4.3",
        "@angular/forms": "4.4.3",
        "@angular/http": "4.4.3",
        "@angular/platform-browser": "4.4.3",
        "@angular/platform-browser-dynamic": "4.4.3",
        "@firebase/webchannel-wrapper": "^0.2.1",
        "@ionic-native/camera": "^4.3.0",
        "@ionic-native/core": "^4.3.1",
        "@ionic-native/facebook": "^4.2.1",
        "@ionic-native/image-picker": "^4.3.1",
        "@ionic-native/splash-screen": "4.3.1",
        "@ionic-native/status-bar": "4.3.1",
        "@ionic/storage": "2.0.1",
        "angularfire2": "^5.0.0-rc.2",
        "cordova-browser": "^4.1.0",
        "cordova-ios": "^4.4.0",
        "cordova-plugin-camera": "^2.4.1",
        "cordova-plugin-compat": "^1.2.0",
        "cordova-plugin-device": "^1.1.4",
        "cordova-plugin-facebook4": "^1.9.1",
        "cordova-plugin-firebase": "^0.1.24",
        "cordova-plugin-splashscreen": "^4.0.3",
        "cordova-plugin-statusbar": "^2.2.2",
        "cordova-plugin-whitelist": "^1.3.1",
        "firebase": "^4.5.0",
        "ionic-angular": "3.7.1",
        "ionic-plugin-keyboard": "^2.2.1",
        "ionic-tags-input": "0.0.6",
        "ionicons": "3.0.0",
        "ng-tags-input": "^3.2.0",
        "promise-polyfill": "^6.0.2",
        "rxjs": "5.4.3",
        "sw-toolbox": "3.6.0",
        "zone.js": "0.8.18"
    },
    "devDependencies": {
        "@angular/cli": "^1.4.3",
        "@ionic/app-scripts": "3.0.0",
        "typescript": "2.5.3"
    },
    "description": "An Ionic project",
    "cordova": {
        "plugins": {
            "cordova-plugin-facebook4": {
                "APP_ID": "***********",
                "APP_NAME": "****"
            },
            "cordova-plugin-device": {},
            "cordova-plugin-splashscreen": {},
            "cordova-plugin-statusbar": {},
            "cordova-plugin-whitelist": {},
            "ionic-plugin-keyboard": {},
            "cordova-plugin-firebase": {},
            "cordova-plugin-camera": {}
        },
        "platforms": [
            "browser",
            "ios"
        ]
    }
}

Or could this be an error with my node or NPM? It would be nice to have some fresh eyes to have a look

like image 782
Harrison Croaker Avatar asked Oct 12 '17 07:10

Harrison Croaker


People also ask

How to remove unexpected string in JSON at position 68741?

Unexpected string in JSON at position 68741 while parsing ' { run following command 'rm package-lock.json' or simply delete the 'package-lock.json' file Are there any code examples left?

When does the JSON parse error occur?

When does this error occur? This error occurs when you are trying to parse a string to JSON and the string is not parsable. In other words, it happens when you pass an invalid JSON string to JSON.parse () function.

Why is my JSON string telling 'unexpected end of JSON input'?

If you observe the JSON string, it starts as a valid JSON, however, the JSON is not complete. Hence it is telling 'unexpected end of JSON input'.

How to convert a URL response to a JSON object?

When we call response.json (), it internally calls JSON.parse () to convert the response into a JSON Object. However, the URL we have passed is of an HTML page and we will be getting an HTML string as the response.


1 Answers

Run the command 'rm package-lock.json', then re-ran 'npm install' and everything worked :)

like image 122
Harrison Croaker Avatar answered Oct 18 '22 03:10

Harrison Croaker