0
votes

I am trying to this template to work but it keeps on giving me errors on npm start. I have already tried reinstalling npm, clearing npm-cache and changing versions. I cannot find anything wrong in package.JSON file.

Here's the error,

npm start
    npm ERR! file /home/singhanurag9080/Downloads/material-react/material-kit-react-master/package.json
    npm ERR! code EJSONPARSE
    npm ERR! JSON.parse Failed to parse json
    npm ERR! JSON.parse Unexpected token { in JSON at position 27 while parsing near '...ckfileVersion": 1
    npm ERR! JSON.parse }
    npm ERR! JSON.parse {
    npm ERR! JSON.parse   "name": "materia...'
    npm ERR! JSON.parse Failed to parse package.json data.
    npm ERR! JSON.parse package.json must be actual JSON, not just JavaScript.
package.JSON

        {
      "name": "material-kit-react",
      "version": "1.8.0",
      "description": "Material Kit React. Coded by Creative Tim",
      "private": true,
      "main": "dist/index.js",
      "dependencies": {
        "@material-ui/core": "4.3.2",
        "@material-ui/icons": "4.2.1",
        "classnames": "2.2.6",
        "history": "4.9.0",
        "moment": "2.24.0",
        "node-sass": "4.12.0",
        "nouislider": "14.0.2",
        "prop-types": "15.7.2",
        "react": "16.9.0",
        "react-datetime": "2.16.3",
        "react-dom": "16.9.0",
        "react-router-dom": "5.0.1",
        "react-scripts": "3.1.0",
        "react-slick": "0.25.2",
        "react-swipeable-views": "0.13.3"
      },
      "devDependencies": {
        "@babel/cli": "7.5.5",
        "@babel/plugin-proposal-class-properties": "7.5.5",
        "@babel/preset-env": "7.5.5",
        "@babel/preset-react": "7.0.0",
        "eslint-config-prettier": "6.0.0",
        "eslint-plugin-prettier": "3.1.0",
        "eslint-plugin-react": "7.14.3",
        "gulp": "4.0.2",
        "gulp-append-prepend": "1.0.8",
        "prettier": "1.18.2"
      },
      "optionalDependencies": {
        "typescript": "3.5.3"
      },
      "scripts": {
        "start": "react-scripts start",
        "build": "react-scripts build && gulp licenses",
        "test": "react-scripts test --env=jsdom",
        "eject": "react-scripts eject",
        "lint:check": "eslint . --ext=js,jsx;  exit 0",
        "lint:fix": "eslint . --ext=js,jsx --fix;  exit 0",
        "install:clean": "rm -rf node_modules/ && rm -rf package-lock.json && npm install && npm start",
        "build-package-css": "node-sass src/assets/scss/material-kit-react.scss dist/material-kit-react.css",
        "build-package": "npm run build-package-css && babel src --out-dir dist",
        "compile-sass": "node-sass src/assets/scss/material-kit-react.scss src/assets/css/material-kit-react.css",
        "minify-sass": "node-sass src/assets/scss/material-kit-react.scss src/assets/css/material-kit-react.min.css --output-style compressed",
        "map-sass": "node-sass src/assets/scss/material-kit-react.scss src/assets/css/material-kit-react.css --source-map true"
      },
      "browserslist": {
        "production": [
          ">0.2%",
          "not dead",
          "not op_mini all"
        ],
        "development": []
      }
    }

Logs:

0 info it worked if it ends with ok
1 verbose cli [ '/home/singhanurag9080/.nvm/versions/node/v10.16.3/bin/node',
1 verbose cli   '/home/singhanurag9080/.nvm/versions/node/v10.16.3/bin/npm',
1 verbose cli   'install',
1 verbose cli   '-g' ]
2 info using [email protected]
3 info using [email protected]
4 verbose npm-session 5398ffab8abd9470
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 silly fetchPackageMetaData error for file: Unexpected token { in JSON at position 27
8 timing stage:rollbackFailedOptional Completed in 1ms
9 timing stage:runTopLevelLifecycles Completed in 22ms
10 verbose stack SyntaxError: Unexpected token { in JSON at position 27
10 verbose stack     at JSON.parse (<anonymous>)
10 verbose stack     at module.exports (/home/singhanurag9080/.nvm/versions/node/v10.16.3/lib/node_modules/npm/node_modules/pacote/lib/util/read-json.js:14:15)
10 verbose stack     at tryCatcher (/home/singhanurag9080/.nvm/versions/node/v10.16.3/lib/node_modules/npm/node_modules/bluebird/js/release/util.js:16:23)
10 verbose stack     at Promise._settlePromiseFromHandler (/home/singhanurag9080/.nvm/versions/node/v10.16.3/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:512:31)
10 verbose stack     at Promise._settlePromise (/home/singhanurag9080/.nvm/versions/node/v10.16.3/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:569:18)
10 verbose stack     at Promise._settlePromise0 (/home/singhanurag9080/.nvm/versions/node/v10.16.3/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:614:10)
10 verbose stack     at Promise._settlePromises (/home/singhanurag9080/.nvm/versions/node/v10.16.3/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:694:18)
10 verbose stack     at Promise._fulfill (/home/singhanurag9080/.nvm/versions/node/v10.16.3/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:638:18)
10 verbose stack     at /home/singhanurag9080/.nvm/versions/node/v10.16.3/lib/node_modules/npm/node_modules/bluebird/js/release/nodeback.js:42:21
10 verbose stack     at /home/singhanurag9080/.nvm/versions/node/v10.16.3/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:90:16
10 verbose stack     at FSReqWrap.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:53:3)
11 verbose cwd /home/singhanurag9080/Downloads/material-react/material-kit-react-master
12 verbose Linux 5.0.0-25-generic
13 verbose argv "/home/singhanurag9080/.nvm/versions/node/v10.16.3/bin/node" "/home/singhanurag9080/.nvm/versions/node/v10.16.3/bin/npm" "install" "-g"
14 verbose node v10.16.3
15 verbose npm  v6.9.0
16 error Unexpected token { in JSON at position 27
17 verbose exit [ 1, true ]

Thanks in advance.

1
What does your package.json look like? It looks like it has a syntax error. A forgotten comma somewhere most likelylaggingreflex

1 Answers

0
votes

It believe there is an invalid character in package.json file. It was better if you had posted the file.