Skip to content
This repository was archived by the owner on Jan 10, 2020. It is now read-only.
This repository was archived by the owner on Jan 10, 2020. It is now read-only.

npm install fails to run on clean install #179

Description

@justinhartman

Describe the bug

I have been trying to run npm install (as well as npm run dev) on a fresh Laravel & Grafite CMS installation but continuously run into a NPM Unexpected end of JSON input while parsing near '...:false,"directories":' error for the buffer-indexof package. I am therefore unable to finalise the setup of Grafite CMS because NPM refuses to install whatever dependencies there may be.

To Reproduce

In a terminal window run the following commands. I've tried it in two different projects and the same error is reproduced every time.

$ composer create-project laravel/laravel grafite
$ composer require grafite/cms
$ php artisan vendor:publish --provider="Grafite\Cms\GrafiteCmsProvider"
$ php artisan grafite:cms-setup
$ npm install

Expected behavior

I don't know what I should be seeing when running npm install but I certainly do not expect to see errors. This is a show-stopper.

Terminal Output

After running php artisan grafite:cms-setup the following is outputted:

$ php artisan grafite:cms-setup
Copying routes...
Copying config...
Copying app/Http...
Copying app/Events...
Copying app/Listeners...
Copying app/Notifications...
Copying app/Models...
Copying app/Services...
Copying database...
Copying resources/views...
Copying tests...
Publishing theme

 Please confirm that you have a database set and configured in your .env file. (yes/no) [no]:
 > yes

Migrating database
Setting roles
Creating default account
Finished setting up your site with Grafite CMS!
You can now login with the following username and password:
admin@example.com
admin
Please add to your app.scss:
@import '../../themes/default/assets/sass/_theme.scss';
Please run:
npm install
and:
npm run dev

This is expected. Now, when running npm install this is the error output:

$ npm install
npm WARN deprecated browserslist@2.11.3: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
npm ERR! Unexpected end of JSON input while parsing near '...:false,"directories":'

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/mbp/.npm/_logs/2018-10-01T21_59_50_434Z-debug.log

This is the key take-out from the debug.log file below. You can view the full debug log file here.

4139 silly resolveWithNewModule multicast-dns-service-types@1.1.0 checking installable status
4140 http fetch GET 200 https://registry.npmjs.org/buffer-indexof 11ms (from cache)
4141 silly fetchPackageMetaData error for buffer-indexof@^1.0.0 Unexpected end of JSON input while parsing near '...:false,"directories":'
4142 timing stage:rollbackFailedOptional Completed in 5ms
4143 timing stage:runTopLevelLifecycles Completed in 89595ms
...
4144 silly saveTree (with tons of output which is snipped in this report.....)
....
4145 verbose stack SyntaxError: Unexpected end of JSON input while parsing near '...:false,"directories":'
4145 verbose stack     at JSON.parse (<anonymous>)
4145 verbose stack     at parseJson (/usr/local/lib/node_modules/npm/node_modules/json-parse-better-errors/index.js:7:17)
4145 verbose stack     at consumeBody.call.then.buffer (/usr/local/lib/node_modules/npm/node_modules/node-fetch-npm/src/body.js:96:50)
4145 verbose stack     at <anonymous>
4145 verbose stack     at process._tickCallback (internal/process/next_tick.js:188:7)
4146 verbose cwd /Volumes/500GB/Mega/Code/GitLab/grafite
4147 verbose Darwin 17.7.0
4148 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
4149 verbose node v8.11.3
4150 verbose npm  v6.4.1
4151 error Unexpected end of JSON input while parsing near '...:false,"directories":'
4152 verbose exit [ 1, true ]

You can view my composer.json file here.

Desktop (please complete the following information):

  • OS: macOS 10.13.6
  • Node: v8.11.3
  • NPM: 6.4.1
  • Darwin: 17.7.0
  • Composer: 1.6.5
  • PHP: 7.2.7
  • Laravel Framework 5.7.6
  • Composer JSON file: composer.json

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions