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

npm install fails to run on clean install #179

Open
justinhartman opened this issue Oct 1, 2018 · 1 comment
Open

npm install fails to run on clean install #179

justinhartman opened this issue Oct 1, 2018 · 1 comment

Comments

@justinhartman
Copy link

justinhartman commented Oct 1, 2018

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
@justinhartman
Copy link
Author

justinhartman commented Oct 1, 2018

The buffer-indexof project was last updated on 22 August 2017 and that was hardly a commit worth noting. In truth, the last major change to the code happened on 1 September 2016 which was over 2 years ago.

I'm very worried that this package is basically dead. I don't know if you guys reference this project in your app directly, or if it forms part of another package's dependency, but I would recommend looking to move away from package. I can't see anything happening with this project in the future. EDIT: I discovered it is a dependency of dns-txt which was, last updated 3 years ago...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant