laravelhomesteadlaravel-vite

Why moving laravel 9 app under homestead I got many npm errors?


I try to run my laravel 9 app under homestead and entering into homestead box I run

composer install

and

npm install

with success. I removed subdirectories node_modules and vendor and cleared I had after working in hosting Kubuntu 20.04)

But on next command I got many errors:

npm run dev

    at FSWatcher.<computed> (internal/fs/watchers.js:243:19)
    at Object.watch (fs.js:1587:34)
    at createFsWatchInstance (file:///home/vagrant/code/MngProducts/node_modules/vite/dist/node/chunks/dep-5605cfa4.js:49748:17)
    at setFsWatchListener (file:///home/vagrant/code/MngProducts/node_modules/vite/dist/node/chunks/dep-5605cfa4.js:49795:15)
    at NodeFsHandler$1._watchWithNodeFs (file:///home/vagrant/code/MngProducts/node_modules/vite/dist/node/chunks/dep-5605cfa4.js:49950:14)
    at NodeFsHandler$1._handleFile (file:///home/vagrant/code/MngProducts/node_modules/vite/dist/node/chunks/dep-5605cfa4.js:50014:23)
    at NodeFsHandler$1._addToNodeFs (file:///home/vagrant/code/MngProducts/node_modules/vite/dist/node/chunks/dep-5605cfa4.js:50256:21)
(node:6395) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 11260)
(node:6395) UnhandledPromiseRejectionWarning: Error: ENOSPC: System limit for number of file watchers reached, watch '/home/vagrant/code/MngProducts/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/ControlStructures/ControlSignatureUnitTest.js.fixed'
    at FSWatcher.<computed> (internal/fs/watchers.js:243:19)
    at Object.watch (fs.js:1587:34)
    at createFsWatchInstance (file:///home/vagrant/code/MngProducts/node_modules/vite/dist/node/chunks/dep-5605cfa4.js:49748:17)
    at setFsWatchListener (file:///home/vagrant/code/MngProducts/node_modules/vite/dist/node/chunks/dep-5605cfa4.js:49795:15)
    at NodeFsHandler$1._watchWithNodeFs (file:///home/vagrant/code/MngProducts/node_modules/vite/dist/node/chunks/dep-5605cfa4.js:49950:14)
    at NodeFsHandler$1._handleFile (file:///home/vagrant/code/MngProducts/node_modules/vite/dist/node/chunks/dep-5605cfa4.js:50014:23)
    at NodeFsHandler$1._addToNodeFs (file:///home/vagrant/code/MngProducts/node_modules/vite/dist/node/chunks/dep-5605cfa4.js:50256:21)
(node:6395) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 11261)
(node:6395) UnhandledPromiseRejectionWarning: Error: ENOSPC: System limit for number of file watchers reached, watch '/home/vagrant/code/MngProducts/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/ControlStructures/ControlSignatureUnitTest.php'
    at FSWatcher.<computed> (internal/fs/watchers.js:243:19)
    at Object.watch (fs.js:1587:34)
    at createFsWatchInstance (file:///home/vagrant/code/MngProducts/node_modules/vite/dist/node/chunks/dep-5605cfa4.js:49748:17)
    at setFsWatchListener (file:///home/vagrant/code/MngProducts/node_modules/vite/dist/node/chunks/dep-5605cfa4.js:49795:15)
    at NodeFsHandler$1._watchWithNodeFs (file:///home/vagrant/code/MngProducts/node_modules/vite/dist/node/chunks/dep-5605cfa4.js:49950:14)
    at NodeFsHandler$1._handleFile (file:///home/vagrant/code/MngProducts/node_modules/vite/dist/node/chunks/dep-5605cfa4.js:50014:23)
    at NodeFsHandler$1._addToNodeFs (file:///home/vagrant/code/MngProducts/node_modules/vite/dist/node/chunks/dep-5605cfa4.js:50256:21)
(node:6395) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 11262)
(node:6395) UnhandledPromiseRejectionWarning: Error: ENOSPC: System limit for number of file watchers reached, watch '/home/vagrant/code/MngProducts/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/ControlStructures/ElseIfDeclarationUnitTest.inc'
    at FSWatcher.<computed> (internal/fs/watchers.js:243:19)
    at Object.watch (fs.js:1587:34)
    at createFsWatchInstance (file:///home/vagrant/code/MngProducts/node_modules/vite/dist/node/chunks/dep-5605cfa4.js:49748:17)
    at setFsWatchListener (file:///home/vagrant/code/MngProducts/node_modules/vite/dist/node/chunks/dep-5605cfa4.js:49795:15)
    at NodeFsHandler$1._watchWithNodeFs (file:///home/vagrant/code/MngProducts/node_modules/vite/dist/node/chunks/dep-5605cfa4.js:49950:14)
    at NodeFsHandler$1._handleFile (file:///home/vagrant/code/MngProducts/node_modules/vite/dist/node/chunks/dep-5605cfa4.js:50014:23)
    at NodeFsHandler$1._addToNodeFs (file:///home/vagrant/code/MngProducts/node_modules/vite/dist/node/chunks/dep-5605cfa4.js:50256:21)
(node:6395) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 11263)
(node:6395) UnhandledPromiseRejectionWarning: Error: ENOSPC: System limit for number of file watchers reached, watch '/home/vagrant/code/MngProducts/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/ControlStructures/ElseIfDeclarationUnitTest.inc.fixed'
    at FSWatcher.<computed> (internal/fs/watchers.js:243:19)
    at Object.watch (fs.js:1587:34)
    at createFsWatchInstance (file:///home/vagrant/code/MngProducts/node_modules/vite/dist/node/chunks/dep-5605cfa4.js:49748:17)
    at setFsWatchListener (file:///home/vagrant/code/MngProducts/node_modules/vite/dist/node/chunks/dep-5605cfa4.js:49795:15)
    at NodeFsHandler$1._watchWithNodeFs (file:///home/vagrant/code/MngProducts/node_modules/vite/dist/node/chunks/dep-5605cfa4.js:49950:14)
    at NodeFsHandler$1._handleFile (file:///home/vagrant/code/MngProducts/node_modules/vite/dist/node/chunks/dep-5605cfa4.js:50014:23)
    at NodeFsHandler$1._addToNodeFs (file:///home/vagrant/code/MngProducts/node_modules/vite/dist/node/chunks/dep-5605cfa4.js:50256:21)
(node:6395) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 11264)
(node:6395) UnhandledPromiseRejectionWarning: Error: ENOSPC: System limit for number of file watchers reached, watch '/home/vagrant/code/MngProducts/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/ControlStructures/ElseIfDeclarationUnitTest.php'
    at FSWatcher.<computed> (internal/fs/watchers.js:243:19)
    at Object.watch (fs.js:1587:34)
    at createFsWatchInstance (file:///home/vagrant/code/MngProducts/node_modules/vite/dist/node/chunks/dep-5605cfa4.js:49748:17)
    at setFsWatchListener (file:///home/vagrant/code/MngProducts/node_modules/vite/dist/node/chunks/dep-5605cfa4.js:49795:15)
    at NodeFsHandler$1._watchWithNodeFs (file:///home/vagrant/code/MngProducts/node_modules/vite/dist/node/chunks/dep-5605cfa4.js:49950:14)
    at NodeFsHandler$1._handleFile (file:///home/vagrant/code/MngProducts/node_modules/vite/dist/node/chunks/dep-5605cfa4.js:50014:23)
    at NodeFsHandler$1._addToNodeFs (file:///home/vagrant/code/MngProducts/node_modules/vite/dist/node/chunks/dep-5605cfa4.js:50256:21)
(node:6395) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 11265)
(node:6395) UnhandledPromiseRejectionWarning: Error: ENOSPC: System limit for number of file watchers reached, watch '/home/vagrant/code/MngProducts/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/ControlStructures/ForEachLoopDeclarationUnitTest.inc'

In my hosting OS :

master@master-at-home:~/Homestead$ uname -a
Linux master-at-home 5.15.0-53-generic #59~20.04.1-Ubuntu SMP Thu Oct 20 15:10:22 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
master@master-at-home:~/Homestead$ dpkg -s  virtualbox
Package: virtualbox
Status: install ok installed
Priority: optional
Section: contrib/misc
Installed-Size: 109341
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Architecture: amd64
Version: 6.1.38-dfsg-3~ubuntu1.20.04.1
Depends: adduser, iproute2, procps, virtualbox-dkms (>= 6.1.38-dfsg-3~ubuntu1.20.04.1) | virtualbox-source (>= 6.1.38-dfsg-3~ubuntu1.20.04.1) | virtualbox-modules, python3 (<< 3.9), python3 (>= 3.8~), python3.8, python3:any, libc6 (>= 2.29), libcurl3-gnutls (>= 7.16.2), libdevmapper1.02.1 (>= 2:1.02.97), libgcc-s1 (>= 3.0), libgl1, libgsoap-2.8.91, liblzf1 (>= 1.5), libopus0 (>= 1.1), libpng16-16 (>= 1.6.2-1), libpython3.8 (>= 3.8.2), libsdl1.2debian (>= 1.2.11), libssl1.1 (>= 1.1.1), libstdc++6 (>= 5.2), libvncserver1 (>= 0.9.10), libvpx6 (>= 1.6.0), libx11-6, libxcursor1 (>> 1.1.2), libxml2 (>= 2.7.4), libxt6, zlib1g (>= 1:1.1.4)
Recommends: virtualbox-qt (= 6.1.38-dfsg-3~ubuntu1.20.04.1), libqt5core5a (>= 5.12.2), libqt5gui5 (>= 5.0.2) | libqt5gui5-gles (>= 5.0.2), libqt5opengl5 (>= 5.0.2), libqt5widgets5 (>= 5.0.2), libxcb1, libxext6
Suggests: vde2, virtualbox-guest-additions-iso
Conflicts: virtualbox-2.0, virtualbox-2.1, virtualbox-2.2, virtualbox-3.0, virtualbox-3.1, virtualbox-3.2, virtualbox-4.0, virtualbox-4.1, virtualbox-4.2, virtualbox-4.3, virtualbox-5.0, virtualbox-5.1, virtualbox-5.2, virtualbox-6.0, virtualbox-6.1
Conffiles:
 /etc/default/virtualbox 903beafa3922607d1ac07950d9ae2d50
 /etc/init.d/virtualbox 651dc62d725baa7d040004ff22a7e433
Description: x86 virtualization solution - base binaries
 VirtualBox is a free x86 virtualization solution allowing a wide range
 of x86 operating systems such as Windows, DOS, BSD or Linux to run on a
 Linux system.
 .
 This package provides the binaries for VirtualBox. Either the virtualbox-dkms
 or the virtualbox-source package is also required in order to compile the
 kernel modules needed for virtualbox. A graphical user interface for
 VirtualBox is provided by the package virtualbox-qt.
Original-Maintainer: Debian Virtualbox Team <team+debian-virtualbox@tracker.debian.org>
Homepage: https://www.virtualbox.org
master@master-at-home:~/Homestead$ dpkg -s  vagrant
Package: vagrant
Status: install ok installed
Priority: optional
Section: admin
Installed-Size: 3104
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Architecture: all
Version: 2.2.6+dfsg-2ubuntu3
Depends: libarchive-tools, curl, openssh-client, rsync, ruby, ruby-bcrypt-pbkdf (>= 1.0.0), ruby-childprocess (>= 0.6.0), ruby-ed25519 (>= 1.2.4), ruby-erubis (>= 2.7.0), ruby-i18n (>= 1.1.1), ruby-listen (>= 3.1.5), ruby-log4r (>= 1.1.9), ruby-net-scp (>= 1.2.0), ruby-net-sftp (>= 2.1), ruby-net-ssh (>= 5.1.0), ruby-rest-client (>= 1.6.0), ruby-vagrant-cloud (>= 2.0.3), ruby-zip (>= 1.2.2)
Recommends: vagrant-libvirt
Suggests: virtualbox (>= 4.0)
Breaks: virtualbox (>= 6.2)
Description: Tool for building and distributing virtualized development environments
 This package provides the tools to create and configure lightweight,
 reproducible, and portable virtual environments.
 .
 Vagrant uses Oracle’s VirtualBox to create its virtual machines and then
 uses Chef or Puppet to provision them.
Homepage: https://www.vagrantup.com
Original-Maintainer: Debian Ruby Team <pkg-ruby-extras-maintainers@lists.alioth.debian.org>
Ruby-Versions: all

inside vagrant box:

vagrant@homestead:~/code/MngProducts$ cd ~/Homestead
vagrant@homestead:~/code/MngProducts$ node -v
v14.20.0
vagrant@homestead:~/code/MngProducts$ npm -v
8.16.0
vagrant@homestead:~/code/MngProducts$ php -v
PHP 8.1.13 (cli) (built: Nov 26 2022 14:07:36) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.13, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.13, Copyright (c), by Zend Technologies
vagrant@homestead:~/code/MngProducts$ uname -a
Linux homestead 5.4.0-124-generic #140-Ubuntu SMP Thu Aug 4 02:23:37 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

In my composer.json :

{
    "name": "laravel/laravel",
    "type": "project",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "require": {
        "php": "^8.0.2",
        "bensampo/laravel-enum": "^5.3",
        "cviebrock/eloquent-sluggable": "^9.0",
        "guzzlehttp/guzzle": "^7.2",
        "intervention/image": "^2.7",
        "jenssegers/mongodb": "^3.9.2",
        "laravel/framework": "^9.3.9",
        "laravel/sanctum": "^3.0",
        "laravel/telescope": "^4.9",
        "laravel/tinker": "^2.7",
        "league/flysystem-aws-s3-v3": "^3.5",
        "maatwebsite/excel": "^3.1",
        "mews/purifier": "^3.3",
        "opcodesio/log-viewer": "^1.2",
        "psr/simple-cache": "^2.0",
        "sentry/sentry-laravel": "^2.13",
        "snipe/banbuilder": "dev-master",
        "spatie/browsershot": "^3.57"
    },
    "require-dev": {
        "barryvdh/laravel-debugbar": "^3.7",
        "barryvdh/laravel-ide-helper": "^2.12",
        "fakerphp/faker": "^1.9.1",
        "laravel/breeze": "^1.11",
        "laravel/pint": "^1.0",
        "laravel/sail": "^1.0.1",
        "mockery/mockery": "^1.4.4",
        "nunomaduro/collision": "^6.1",
        "phpunit/phpunit": "^9.5.10",
        "sempro/phpunit-pretty-print": "^1.4",
        "spatie/laravel-ignition": "^1.0",
        "squizlabs/php_codesniffer": "*"
    },
    "autoload": {
        "files": [
            "app/Library/helper.php"
        ],

        "psr-4": {
            "App\\": "app/",
            "Database\\Factories\\": "database/factories/",
            "Database\\Seeders\\": "database/seeders/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/"
        }
    },
    "scripts": {
        "post-autoload-dump": [
            "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
            "@php artisan package:discover --ansi"
        ],
        "post-update-cmd": [
            "@php artisan vendor:publish --tag=laravel-assets --ansi --force"
        ],
        "post-root-package-install": [
            "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "@php artisan key:generate --ansi"
        ]
    },
    "extra": {
        "laravel": {
            "dont-discover": []
        }
    },
    "config": {
        "optimize-autoloader": true,
        "preferred-install": "dist",
        "sort-packages": true,
        "allow-plugins": {
            "pestphp/pest-plugin": true
        }
    },
    "minimum-stability": "dev",
    "prefer-stable": true
}

What is wrong and how that can be fixed ?

Thanks!


Solution

  • After some attempts I found a decision to install not the latest homestead, but from one of prior versions :

    git clone https://github.com/laravel/homestead --branch v13.3.0
    

    and with this version of homestead I do not have such problems