npm install giving Error after so many WARN

23,767

If you see the log, for old packages, it gives a Warning and not an Error. The error is actually this line: npm ERR! Unexpected end of JSON input while parsing near '...on" : "10.16.3"

npm ERR!}'

Since you have not included the entire log, with this, I can guess it is possibly an ambiguity issue due to references not properly resolved!

Open command prompt/powershell/terminal, etc. with admin privilege. Do as below: -

  • sudo npm cache clean --force
  • sudo npm cache verify
  • Delete the package-lock.json file located in C:\Users\<your_username>

Try installing your project dependencies now from your project folder with npm i.

Note: - If this doesn't work, follow the same process as above (again) and uninstall the npm and node and reinstall it. It should work then!

Share:
23,767
solveit
Author by

solveit

Updated on July 08, 2020

Comments

  • solveit
    solveit almost 4 years

    My ReactJS project was working all fine till last week but from Sunday its giving below error on npm install:

    PS C:\Projects\Interface\ClientApp> npm install
    npm WARN deprecated [email protected]: Use @material-ui/icons instead
    npm WARN deprecated [email protected]: You can now upgrade to @material-ui/core
    npm WARN deprecated [email protected]: core-js@<3 is no longer maintained and not
             recommended for usage due to the number of issues. Please, upgrade your
             dependencies to the actual version of core-js@3.
    npm WARN deprecated [email protected]: You can find the new Popper v2 at @popperjs/core,
             this package is dedicated to the legacy v1
    npm WARN deprecated [email protected]: You can now upgrade to
             @material-ui/pickers. Documentation for v2 can be found at
             https://material-ui-pickers-v2.dmtr-kovalenko.now.sh/
    npm WARN deprecated [email protected]: Deprecated. Please use
             https://github.com/webpack-contrib/mini-css-extract-plugin
    npm WARN deprecated [email protected]: fsevents 1 will break on node v14+ and could
             be using insecure binaries. Upgrade to fsevents 2.
    npm WARN deprecated [email protected]: core-js@<3 is no longer maintained and not
             recommended for usage due to the number of issues. Please, upgrade your
             dependencies to the actual version of core-js@3.
    npm WARN deprecated [email protected]: use String.prototype.padStart()
    npm WARN deprecated [email protected]: Browserslist 2 could fail on reading 
             Browserslist >3.0 config used in other tools.
    npm WARN deprecated [email protected]: Please migrate to Workbox:
             https://developers.google.com/web/tools/workbox/guides/migrations/migrate-from-sw
    npm WARN deprecated [email protected]: Chokidar 2 will break on node v14+.
             Upgrade to chokidar 3 with 15x less dependencies.
    npm WARN deprecated [email protected]: Please migrate to Workbox:
             https://developers.google.com/web/tools/workbox/guides/migrations/migrate-from-sw
    npm WARN deprecated [email protected]: fsevents 1 will break on node v14+ and could
             be using insecure binaries. Upgrade to fsevents 2.
    npm WARN deprecated [email protected]: This module moved to @hapi/hawk. Please make sure to
             switch over as this distribution is no longer supported and may contain
             bugs and critical security issues.
    npm WARN deprecated [email protected]: request has been deprecated,
             see https://github.com/request/request/issues/3142
    npm WARN deprecated [email protected]: Chokidar 2 will break on node v14+. Upgrade
             to chokidar 3 with 15x less dependencies.
    npm WARN deprecated [email protected]: request has been deprecated, see
             https://github.com/request/request/issues/3142
    npm WARN deprecated [email protected]: This is not needed anymore.
             Use `require('os').homedir()` instead.
    npm WARN deprecated [email protected]: Browserslist 2 could fail on reading
             Browserslist >3.0 config used in other tools.
    npm WARN deprecated [email protected]: CircularJSON is in maintenance only,
             flatted is its successor. npm WARN deprecated [email protected]: This version
             has been deprecated in accordance with the hapi support policy (hapi.im/support).
             Please upgrade to the latest version to get the best features, bug fixes,
             and security patches. If you are unable to upgrade at this time, paid 
             support is available for older versions (hapi.im/commercial).
    npm WARN deprecated [email protected]: This version has been deprecated in accordance
             with the hapi support policy (hapi.im/support). Please upgrade to the 
             latest version to get the best features, bug fixes, and security patches. 
             If you are unable to upgrade at this time, paid support is available for 
             older versions (hapi.im/commercial).
    npm WARN deprecated [email protected]: This version has been deprecated in accordance
             with the hapi support policy (hapi.im/support). Please upgrade to the 
             latest version to get the best features, bug fixes, and security patches. 
             If you are unable to upgrade at this time, paid support is available for 
             older versions (hapi.im/commercial).
    npm WARN deprecated [email protected]: This module moved to @hapi/sntp. Please make sure 
             to switch over as this distribution is no longer supported and may contain 
             bugs and critical security issues.
    npm WARN deprecated [email protected]: https://github.com/lydell/resolve-url#deprecated
    npm WARN deprecated [email protected]: Please see https://github.com/lydell/urix#deprecated
    npm ERR! Unexpected end of JSON input while parsing near '...on" : "10.16.3"
    npm ERR!     }'
    
    npm ERR! A complete log of this run can be found in: npm ERR!    
    C:\Users\AppData\Roaming\npm-cache\_logs\2020-07-06T10_18_35_852Z-debug.log
    

    Note

    1. I have upgraded the npm from 6.9.0 to 6.14.5 then also facing same issue
    2. I have removed package.json.lock and node_modules then also facing same issue

    Please do let me know what else I am missing ? --------------My package.json--------------

    {
      "name": "clientapp",
      "version": "0.1.0",
      "private": true,
      "dependencies": {
        "@material-ui/core": "^4.9.5",
        "@material-ui/icons": "^4.4.1",
        "@material-ui/lab": "^4.0.0-alpha.45",
        "@material/typography": "^3.1.0",
        "@trendmicro/react-sidenav": "^0.4.5",
        "axios": "^0.19.0",
        "bootstrap": "^3.4.1",
        "flux": "^3.1.3",
        "jquery": "^3.4.1",
        "match-sorter": "^4.0.2",
        "material-grid": "^0.1.0",
        "material-table": "^1.54.2",
        "material-ui": "^0.20.2",
        "material-ui-colors": "^1.0.0",
        "material-ui-icons": "^1.0.0-beta.36",
        "mdbreact": "^4.22.0",
        "oidc-client": "^1.5.4",
        "plotly.js": "^1.49.4",
        "prop-types": "^15.7.2",
        "react": "^16.13.0",
        "react-bootstrap": "^0.31.5",
        "react-bootstrap-tabs": "^1.0.2",
        "react-dom": "^16.13.0",
        "react-flippy": "^0.1.5",
        "react-loader-spinner": "^3.1.5",
        "react-minimal-pie-chart": "^6.0.1",
        "react-plotly.js": "^2.3.0",
        "react-redux": "^7.1.3",
        "react-redux-loading-bar": "^4.5.0",
        "react-router-bootstrap": "^0.24.4",
        "react-router-dom": "^4.2.2",
        "react-scripts": "1.0.17",
        "react-slideshow-image": "^1.4.0",
        "react-sortable-tree": "^2.7.1",
        "react-stack-grid": "^0.7.1",
        "react-stonecutter": "^0.3.10",
        "react-table": "^7.0.0-rc.15",
        "react-web-tabs": "^1.0.1",
        "redux": "^4.0.4",
        "rimraf": "^2.6.2",
        "webpack": "*"
      },
      "scripts": {
        "start": "react-scripts start",
        "build": "react-scripts build",
        "test": "react-scripts test",
        "eject": "react-scripts eject"
      }
    }
    
  • solveit
    solveit almost 4 years
    so shall I simply remove "@material-ui/core": "^4.9.5", from my package.json and again do - "npm install @material-ui/core" from cmd ?
  • u tyagi
    u tyagi about 2 years
    Yes indeed, npm:WARN gone after cache cleaning.