question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Too many sass files causes version() to fail

See original GitHub issue
  • Laravel Mix Version: 1.4.2
  • Node Version: 7.10.1
  • NPM Version: 4.2.0
  • OS: Ubuntu

Description:

Mix fails on validation when too many sass files are being used.

fs.js:584
  return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
                 ^

Error: ENOENT: no such file or directory, open '/home/thomas/Projects/5.4/public/css/tour/ourusers.css'
    at Object.fs.openSync (fs.js:584:18)
    at Object.fs.readFileSync (fs.js:491:33)
    at File.read (/home/thomas/Projects/5.4/node_modules/laravel-mix/src/File.js:180:19)
    at File.version (/home/thomas/Projects/5.4/node_modules/laravel-mix/src/File.js:190:25)
    at Manifest.hash (/home/thomas/Projects/5.4/node_modules/laravel-mix/src/Manifest.js:55:65)
    at manifest.forEach.file (/home/thomas/Projects/5.4/node_modules/laravel-mix/src/plugins/CustomTasksPlugin.js:79:47)
    at Array.forEach (native)
    at CustomTasksPlugin.applyVersioning (/home/thomas/Projects/5.4/node_modules/laravel-mix/src/plugins/CustomTasksPlugin.js:79:18)
    at Compiler.compiler.plugin.stats (/home/thomas/Projects/5.4/node_modules/laravel-mix/src/plugins/CustomTasksPlugin.js:12:22)
    at Compiler.applyPlugins (/home/thomas/Projects/5.4/node_modules/tapable/lib/Tapable.js:61:14)
    at emitRecords.err (/home/thomas/Projects/5.4/node_modules/webpack/lib/Compiler.js:268:11)
    at Compiler.emitRecords (/home/thomas/Projects/5.4/node_modules/webpack/lib/Compiler.js:375:38)
    at emitAssets.err (/home/thomas/Projects/5.4/node_modules/webpack/lib/Compiler.js:262:10)
    at applyPluginsAsyncSeries1.err (/home/thomas/Projects/5.4/node_modules/webpack/lib/Compiler.js:368:12)
    at next (/home/thomas/Projects/5.4/node_modules/tapable/lib/Tapable.js:200:11)
    at Compiler.compiler.plugin (/home/thomas/Projects/5.4/node_modules/webpack/lib/performance/SizeLimitsPlugin.js:99:4)
    at Compiler.applyPluginsAsyncSeries1 (/home/thomas/Projects/5.4/node_modules/tapable/lib/Tapable.js:204:13)
    at Compiler.afterEmit (/home/thomas/Projects/5.4/node_modules/webpack/lib/Compiler.js:365:9)
    at require.forEach.err (/home/thomas/Projects/5.4/node_modules/webpack/lib/Compiler.js:360:15)
    at /home/thomas/Projects/5.4/node_modules/async/dist/async.js:421:16
    at iteratorCallback (/home/thomas/Projects/5.4/node_modules/async/dist/async.js:998:13)
    at /home/thomas/Projects/5.4/node_modules/async/dist/async.js:906:16
    at /home/thomas/Projects/5.4/node_modules/graceful-fs/graceful-fs.js:43:10
    at FSReqWrap.oncomplete (fs.js:114:15)

Steps To Reproduce:

On a fresh 5.4 installation create the files matching the webpack.mix.js sass files. Empty sass files will still cause the error. webpack.mix.js

let mix = require('laravel-mix');

/*
 |--------------------------------------------------------------------------
 | Mix Asset Management
 |--------------------------------------------------------------------------
 |
 | Mix provides a clean, fluent API for defining some Webpack build steps
 | for your Laravel application. By default, we are compiling the Sass
 | file for the application as well as bundling up all the JS files.
 |
 */

mix.sass('resources/assets/sass/tour/master.scss', 'css/tour')
    .sass('resources/assets/sass/tour/home.scss', 'css/tour')
    .sass('resources/assets/sass/tour/header.scss', 'css/tour')
    .sass('resources/assets/sass/tour/footer.scss', 'css/tour')
    .sass('resources/assets/sass/tour/userfinder.scss', 'css/tour')
    .sass('resources/assets/sass/tour/newusers.scss', 'css/tour')
    .sass('resources/assets/sass/tour/ourusers.scss', 'css/tour')
    .sass('resources/assets/sass/tour/tour_scene.scss', 'css/tour')
    .sass('resources/assets/sass/tour/userprofile.scss', 'css/tour')
    .sass('resources/assets/sass/tour/join_options.scss', 'css/tour')
    .sass('resources/assets/sass/tour/lightbox.scss', 'css/tour/')
    .sass('resources/assets/sass/tour/slick.scss', 'css/tour/')
    .sass('resources/assets/sass/tour/slick-theme.scss', 'css/tour/')
    .version();

package.json

{
  "private": true,
  "scripts": {
    "dev": "npm run development",
    "development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
    "watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
    "watch-poll": "npm run watch -- --watch-poll",
    "hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
    "prod": "npm run production",
    "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
  },
  "devDependencies": {
    "axios": "^0.16.2",
    "bootstrap-sass": "^3.3.7",
    "cross-env": "^5.0.1",
    "jquery": "^3.1.1",
    "laravel-mix": "^1.0",
    "lodash": "^4.17.4",
    "vue": "^2.1.10"
  }
}

Either commenting out version() or a number of .sass() lines will allow Mix to complete properly.

If I downgrade to v0.12.1 everything appears to work correctly

From my research it appears that the version task, or some task related to it is being executed before the files have been written to the disk.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
trideoutcommented, Aug 4, 2017

Many of the CSS files are only loaded on one or two pages, and this is only a selection of the hundreds of sass files the complete project has. These files are not partials, they are intended to be loaded on an as needed basis.

0reactions
stale[bot]commented, Dec 4, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error with node-sass when running npm install - Stack Overflow
Apparently, the version of assets I was trying to install were too old to work with a current version of npm so downgrading...
Read more >
Do Not Delete Existing Output CSS File if Compiling Fails #995
I'm using the CLI and passing Dart Sass the input and output paths to use. I am also passing --no-error-css . Currently, if...
Read more >
Handling Unused CSS In Sass To Improve Performance
Do you know the impact unused CSS has on performance? Spoiler: It's a lot! In this article, we'll explore a Sass-oriented solution for ......
Read more >
Sass: @use
If you want to load members from many files at once, you can use the @forward rule to forward them all from one...
Read more >
Stop using @import with Sass | @use and @forward explained
Keep up to date with my Sass course: https://beyondcss.dev/?utm_campaign=OlderYouTubeVideos&utm_source=YouTubeThe use of @import has been ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found