This tutorial provides a resolution to the error Unsupported platform for fsevents on Windows system while using NPM to install the assets of Laravel UI.
Steps to generate the error
Step 1 - Install Laravel UI
# Install Laravel UI composer require laravel/ui
Step 2 - Scaffold the UI
We can scaffold the UI using the commands shown below.
# Generate Auth Files - Bootstrap php artisan ui bootstrap --auth
# Generate Auth Files - React php artisan ui react --auth
# Generate Auth Files - Vue php artisan ui vue --auth
Step 3 - Compile and Install the assets
We can compile and install the assets using the commands shown below.
# NPM Install npm install
#NPM Run npm run dev
Error
The above-mentioned commands will generate the error and complain about missing fsevents.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.3.2 (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
The complete log for NPM install is shown below.
$ npm install
npm WARN deprecated popper.js@1.16.1: You can find the new Popper v2 at @popperjs/core, this package is dedicated to the legacy v1
npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.3.2 (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN sass-loader@11.1.1 requires a peer of fibers@>= 3.1.0 but none is installed. You must install peer dependencies yourself.
npm WARN sass-loader@11.1.1 requires a peer of node-sass@^4.0.0 || ^5.0.0 || ^6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN postcss-load-config@3.1.0 requires a peer of ts-node@>=9.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN ws@8.2.2 requires a peer of bufferutil@^4.0.1 but none is installed. You must install peer dependencies yourself.
npm WARN ws@8.2.2 requires a peer of utf-8-validate@^5.0.2 but none is installed. You must install peer dependencies yourself.
added 776 packages from 445 contributors and audited 779 packages in 59.009s 86 packages are looking for funding run `npm fund` for details found 0 vulnerabilities
The complete log for the NPM run is shown below.
$ npm run dev > @ dev E:\development\projects-study\php\laravel\lblogdemo > npm run development
> @ development E:\development\projects-study\php\laravel\lblogdemo > mix
Additional dependencies must be installed. This will only take a moment.
Running: npm install resolve-url-loader@^4.0.0 --save-dev --legacy-peer-deps
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
Finished. Please run Mix again.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ development: `mix`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ development script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\bhagw\AppData\Roaming\npm-cache\_logs\2021-09-22T04_43_12_817Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ dev: `npm run development`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\bhagw\AppData\Roaming\npm-cache\_logs\2021-09-22T04_43_12_856Z-debug.log
Resolution
We can run the command NPM install with the force argument as shown below.
# NPM Install on Windows
npm install -f
#NPM Run
npm run dev