Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Mfrancik's avatar

Module not found: Error: Can't resolve 'file' in 'directory'

I am working on a new spark project. I used laravel shift to update 5.2 to 5.3. I registered spark and all of the prebuilt stuff is working fine. From the settings page I am trying to create a new panel and with windows just as it is prebuilt. I have followed https://laracasts.com/discuss/channels/spark/adding-a-settings-tab?page=0, deleted, tried again about 5 times. When I run gulp I get the following error:

[22:37:49] Starting 'webpack'...
{ [Error: ./resources/assets/js/spark-components/settings/users.js
Module not found: Error: Can't resolve 'settings/users' in '/Users/mikefrancik/Code/SoberHouseWare/resources/assets/js/spark-components/settings'
resolve 'settings/users' in '/Users/mikefrancik/Code/SoberHouseWare/resources/assets/js/spark-components/settings'
  Parsed request is a module
  using description file: /Users/mikefrancik/Code/SoberHouseWare/package.json (relative path: ./resources/assets/js/spark-components/settings)
    Field 'browser' doesn't contain a valid alias configuration
  after using description file: /Users/mikefrancik/Code/SoberHouseWare/package.json (relative path: ./resources/assets/js/spark-components/settings)
    resolve as module
      /Users/mikefrancik/Code/SoberHouseWare/resources/assets/js/node_modules doesn't exist or is not a directory
      /Users/mikefrancik/Code/SoberHouseWare/resources/assets/node_modules doesn't exist or is not a directory
      /Users/mikefrancik/Code/SoberHouseWare/resources/node_modules doesn't exist or is not a directory
      /Users/mikefrancik/Code/node_modules doesn't exist or is not a directory
      /Users/mikefrancik/node_modules doesn't exist or is not a directory
      /Users/node_modules doesn't exist or is not a directory
      /node_modules doesn't exist or is not a directory
      /Users/mikefrancik/Code/SoberHouseWare/resources/assets/js/spark-components/node_modules doesn't exist or is not a directory
      /Users/mikefrancik/Code/SoberHouseWare/resources/assets/js/spark-components/settings/node_modules doesn't exist or is not a directory
      looking for modules in /Users/mikefrancik/Code/SoberHouseWare/vendor/laravel/spark/resources/assets/js
        using description file: /Users/mikefrancik/Code/SoberHouseWare/vendor/laravel/spark/package.json (relative path: ./resources/assets/js)
          Field 'browser' doesn't contain a valid alias configuration
        after using description file: /Users/mikefrancik/Code/SoberHouseWare/vendor/laravel/spark/package.json (relative path: ./resources/assets/js)
          using description file: /Users/mikefrancik/Code/SoberHouseWare/vendor/laravel/spark/package.json (relative path: ./resources/assets/js/settings/users)
            as directory
.....
....

Can somebody point me in the right direction on this?

0 likes
4 replies
Leff7's avatar

Having the same issue myself.

willbrowning's avatar

Similar issue here since last Spark update. Gulp keeps failing, will post here if I find a solution.

willbrowning's avatar

@Cronix I've updated the package.json file and tried running npm run dev, it appears to work however I then get "Uncaught ReferenceError: jQuery is not defined" in the console when visiting the site.

So should we no longer be using gulp for compiling Spark's assets?

UPDATE:

I've got gulp working again, make sure you have all node_modules and peer dependencies installed.

Also add the .json preloader like below in gulpfile.js:

module: {
        preLoaders: [
            { test: /\.json$/, loader: 'json'}
        ],
        loaders: [
            {
                test: /\.js$/,
                loader: 'buble'
            },
            {
                test: /\.css$/,
                loader: 'style!css'
            }
        ]
    }

This got it working again for me.

Please or to participate in this conversation.