How to fix the Laravel Gulp Error: Cannot find module ‘internal/fs’

Laravel Gulp Error: Cannot find module ‘internal/fs’

Get this error?

vagrant@homestead:*****$ gulp
module.js:472
    throw err;
    ^

Error: Cannot find module 'internal/fs'
    at Function.Module._resolveFilename (module.js:470:15)
    at Function.Module._load (module.js:418:25)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at evalmachine.:18:20
    at Object. (/usr/lib/node_modules/gulp/node_modules/vinyl-fs/node_modules/graceful-fs/fs.js:11:1)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)

How to fix this error?

Thanks to Softwarehorizont, I found the solution:

Try to delete all node modules and reinstall them. A command sequence like this would do:

npm cache clean
rm -Rf node_modules/
npm install

Still got this error?

If you still got this error, you can look up the following references (I have not tested these, at your own risk, like all solutions posted on this blog):

  1. https://github.com/nodejs/node/issues/9377
  2. http://stackoverflow.com/questions/40663489/npm-not-working-cannot-find-module-internal-fs-nodejs


Travis CI – Laravel Forge / webhook integration

While developing tests for my app, I wanted to have an integration with Laravel Forge in this order:

  1. Push to Github after commit
  2. Tests done by Travis CI
  3. Call the deployment trigger url of Laravel Forge / Envoyer if the test runs successfully. This URL looks like: https://forge.laravel.com/servers/111111/sites/2222222/deploy/http?token=TOKEN

To do this, create a travis.yml file like:

language: php

php:
  - 7.1

before_script:
  - cp .env.travis .env
  - mysql -e 'create database db_testing';
  - composer self-update
  - composer install --no-interaction
  - php artisan migrate

script:
  - vendor/bin/phpunit

after_success:
  - chmod +x ./tests.sh; ./tests.sh

Don’t forget to change the environment in phpunit.xml for example to change to a custom database:


The after_success script

Create a file tests.sh and insert:

#!/bin/bash

# Trigger deployment
# Replace the url below with your Forge/Laravel url
curl -s 'https://forge.laravel.com/servers/111111/sites/2222222/deploy/http?token=TOKEN';
echo 'Deployment triggered!'

 

Using other services than Travis or creating a custom test service

https://driesvints.com/blog/continuous-delivery-with-forge-and-envoyer/

Also thanks to: