Gatsby: Unable to install Gatsby

Created on 1 Oct 2018  路  12Comments  路  Source: gatsbyjs/gatsby

Description

I'm unable to install gatsby on my existing site, trying to run npm install

Steps to reproduce

  1. Clone Repo
  2. Run npm install

Expected result

Gatsby should install

Actual result

npm ERR! Unexpected end of JSON input while parsing near '...^9.14.0","ignore":"^3'

Attached debug log below

2018-10-01T16_10_46_442Z-debug.log

Environment

  System:
    OS: Windows 10
    CPU: x64 Intel(R) Core(TM) i5-7300U CPU @
2.60GHz
  Binaries:
    npm: 6.1.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: 42.17134.1.0
  npmPackages:
    gatsby-image: ^2.0.12 => 2.0.13
    gatsby-plugin-netlify-cms: next => 3.0.0-rc.5
    gatsby-plugin-react-helmet: ^3.0.0-rc.1 => 3.0.0
    gatsby-plugin-sass: ^2.0.1 => 2.0.1
    gatsby-plugin-sharp: ^2.0.0-rc.7 => 2.0.5
    gatsby-plugin-twitter: ^2.0.5 => 2.0.5
    gatsby-remark-images: ^2.0.3 => 2.0.3
    gatsby-source-filesystem: ^1.5.39 => 1.5.39
    gatsby-transformer-remark: ^1.7.44 => 1.7.44
    gatsby-transformer-sharp: ^2.1.1 => 2.1.3

error The system cannot find the path specified.



  Error: The system cannot find the path speci  fied.

  - envinfo.js:1 Function.e.exports.sync
    [v10.7.0]/[gatsby-cli]/[envinfo]/dist/envi    nfo.js:1:7778

  - envinfo.js:1 Object.copySync
    [v10.7.0]/[gatsby-cli]/[envinfo]/dist/envi    nfo.js:1:104976

  - envinfo.js:1 Object.t.writeSync.e [as writ    eSync]
    [v10.7.0]/[gatsby-cli]/[envinfo]/dist/envi    nfo.js:1:123499

  - envinfo.js:1
    [v10.7.0]/[gatsby-cli]/[envinfo]/dist/envi    nfo.js:1:124274

  - envinfo.js:1 Promise.all.then.e
    [v10.7.0]/[gatsby-cli]/[envinfo]/dist/envi    nfo.js:1:124289

  - util.js:16 tryCatcher
    [v10.7.0]/[gatsby-cli]/[bluebird]/js/relea    se/util.js:16:23

  - promise.js:512 Promise._settlePromiseFromH    andler
    [v10.7.0]/[gatsby-cli]/[bluebird]/js/relea    se/promise.js:512:31

  - promise.js:569 Promise._settlePromise
    [v10.7.0]/[gatsby-cli]/[bluebird]/js/relea    se/promise.js:569:18

  - promise.js:614 Promise._settlePromise0
    [v10.7.0]/[gatsby-cli]/[bluebird]/js/relea    se/promise.js:614:10

  - promise.js:694 Promise._settlePromises
    [v10.7.0]/[gatsby-cli]/[bluebird]/js/relea    se/promise.js:694:18

  - promise.js:638 Promise._fulfill
    [v10.7.0]/[gatsby-cli]/[bluebird]/js/relea    se/promise.js:638:18

  - promise_array.js:126 PromiseArray._resolve    [v10.7.0]/[gatsby-cli]/[bluebird]/js/relea    se/promise_array.js:126:19

  - promise_array.js:144 PromiseArray._promise    Fulfilled
    [v10.7.0]/[gatsby-cli]/[bluebird]/js/relea    se/promise_array.js:144:14

  - promise.js:574 Promise._settlePromise
    [v10.7.0]/[gatsby-cli]/[bluebird]/js/relea    se/promise.js:574:26

  - promise.js:614 Promise._settlePromise0
    [v10.7.0]/[gatsby-cli]/[bluebird]/js/relea    se/promise.js:614:10

  - promise.js:694 Promise._settlePromises
    [v10.7.0]/[gatsby-cli]/[bluebird]/js/relea    se/promise.js:694:18


error UNHANDLED REJECTION


  Error: The system cannot find the path speci  fied.

  - envinfo.js:1 Function.e.exports.sync
    [v10.7.0]/[gatsby-cli]/[envinfo]/dist/envi    nfo.js:1:7778

  - envinfo.js:1 Object.copySync
    [v10.7.0]/[gatsby-cli]/[envinfo]/dist/envi    nfo.js:1:104976

  - envinfo.js:1 Object.t.writeSync.e [as writ    eSync]
    [v10.7.0]/[gatsby-cli]/[envinfo]/dist/envi    nfo.js:1:123499

  - envinfo.js:1
    [v10.7.0]/[gatsby-cli]/[envinfo]/dist/envi    nfo.js:1:124274

  - envinfo.js:1 Promise.all.then.e
    [v10.7.0]/[gatsby-cli]/[envinfo]/dist/envi    nfo.js:1:124289

  - util.js:16 tryCatcher
    [v10.7.0]/[gatsby-cli]/[bluebird]/js/relea    se/util.js:16:23

  - promise.js:512 Promise._settlePromiseFromH    andler
    [v10.7.0]/[gatsby-cli]/[bluebird]/js/relea    se/promise.js:512:31

  - promise.js:569 Promise._settlePromise
    [v10.7.0]/[gatsby-cli]/[bluebird]/js/relea    se/promise.js:569:18

  - promise.js:614 Promise._settlePromise0
    [v10.7.0]/[gatsby-cli]/[bluebird]/js/relea    se/promise.js:614:10

  - promise.js:694 Promise._settlePromises
    [v10.7.0]/[gatsby-cli]/[bluebird]/js/relea    se/promise.js:694:18

  - promise.js:638 Promise._fulfill
    [v10.7.0]/[gatsby-cli]/[bluebird]/js/relea    se/promise.js:638:18

  - promise_array.js:126 PromiseArray._resolve    [v10.7.0]/[gatsby-cli]/[bluebird]/js/relea    se/promise_array.js:126:19

  - promise_array.js:144 PromiseArray._promise    Fulfilled
    [v10.7.0]/[gatsby-cli]/[bluebird]/js/relea    se/promise_array.js:144:14

  - promise.js:574 Promise._settlePromise
    [v10.7.0]/[gatsby-cli]/[bluebird]/js/relea    se/promise.js:574:26

  - promise.js:614 Promise._settlePromise0
    [v10.7.0]/[gatsby-cli]/[bluebird]/js/relea    se/promise.js:614:10

  - promise.js:694 Promise._settlePromises
    [v10.7.0]/[gatsby-cli]/[bluebird]/js/relea    se/promise.js:694:18
stale? awaiting author response needs more info

Most helpful comment

Please try clearing the npm caches (with --force).

npm cache clean --force

All 12 comments

@amykapernick can you try upgrading your npm version? This might be a windows OS only issue.

I've updated to node v10.11.0 (which is the latest there is) and npm 6.4.1 and am still getting the same error.
I did have it working fine previously but deleted the node modules folder and now it won't install

If you have lock files(package-lock.json), can you try removing them as well and try npm install?

If it doesn't work for you, please give a try to yarn

I don't have a lock file but it works installing using yarn.

If you can resolve this so it works with npm though, I'd like to be able to continue using that.

I'm not sure why it is not working withnpm but it does with yarn.

@pieh do you have any idea regarding this?

Still only seem to be able to use yarn to install Gatsby, any updates on this?

I have run into this issue while executing npm install gatsby-cli.

Here is the log

8 silly fetchPackageMetaData error for gatsby-cli@latest Unexpected end of JSON input while parsing near '...ce":"^0.0.10","update'
9 verbose stack SyntaxError: Unexpected end of JSON input while parsing near '...ce":"^0.0.10","update'
9 verbose stack     at JSON.parse (<anonymous>)
9 verbose stack     at parseJson (/usr/local/lib/node_modules/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/node-fetch-npm/node_modules/json-parse-better-errors/index.js:7:17)
9 verbose stack     at consumeBody.call.then.buffer (/usr/local/lib/node_modules/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/node-fetch-npm/src/body.js:96:50)
9 verbose stack     at <anonymous>
9 verbose stack     at process._tickCallback (internal/process/next_tick.js:188:7)
10 verbose cwd /home/gitlab-runner/builds/6a135e89/0/liang/developer
11 verbose Linux 3.10.0-693.21.1.el7.x86_64
12 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "gatsby-cli"

Node version: v8.11.1.
Weird thing is that after switching to root user, this issue is gone. Not sure why.

Please try clearing the npm caches (with --force).

npm cache clean --force

It is a known bug in npm and its cache implementation.

Yarn has its own local cache.

https://www.google.com/search?q="Unexpected+end+of+JSON+input+while+parsing+near"

This is also why we still use Yarn at work.

Hiya!

This issue has gone quiet. Spooky quiet. 馃懟

We get a lot of issues, so we currently close issues after 30 days of inactivity. It鈥檚 been at least 20 days since the last update here.

If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open!

Thanks for being a part of the Gatsby community! 馃挭馃挏

Hey again!

It鈥檚 been 30 days since anything happened on this issue, so our friendly neighborhood robot (that鈥檚 me!) is going to close it.

Please keep in mind that I鈥檓 only a robot, so if I鈥檝e closed this issue in error, I鈥檓 HUMAN_EMOTION_SORRY. Please feel free to reopen this issue or create a new one if you need anything else.

Thanks again for being part of the Gatsby community!

Was this page helpful?
0 / 5 - 0 ratings