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.

mix.version() error: Error: ENOENT: no such file or directory, open '/css/app.css'

See original GitHub issue

I’m using standalone version of laravel-mix@1.6.1 with npm@5.5.1 and I’m only compiling scss file:

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

mix
    .setPublicPath('/')
    .sass('scss/app.scss', 'css/')
    .sourceMaps()
    .version();

When run with version() it throws an error:

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

Error: ENOENT: no such file or directory, open '/css/app.css'
    at Object.fs.openSync (fs.js:646:18)
    at Object.fs.readFileSync (fs.js:551:33)
...

When I remove call to version() - it does compile without any issues, but of course, manifest does not have version parameter.

I also tried to changing the public path to the relative ./:

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

mix
    .setPublicPath('./')
    .sass('scss/app.scss', 'css/')
    .sourceMaps()
    .version();

but this has resulted with the same error (except for the path, which now was showing as absolute) and mix-manifest.json has cut first letter from the directory - still without the version present:

{
    "/ss/app.css": "/ss/app.css"
}

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:4
  • Comments:12 (1 by maintainers)

github_iconTop GitHub Comments

58reactions
andyblackwellcommented, Jan 12, 2018

since the public path is currently used straight in a regex, it’s the . that was causing errors for me. I was able to get around it for now by calling path.resolve() on the relative path.

mix.setPublicPath(path.resolve('./'))
51reactions
n7olkachevcommented, Nov 13, 2019

setPublicPath('public') may help you while dockerization with multi-stage builds, because mix will not set it if artisan file doesn’t exist.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error: ENOENT: no such file or directory, open '/css ... - GitHub
I'm using standalone version of laravel-mix@1.6.1 with npm@5.5.1 and I'm only compiling scss file: let mix = require('laravel-mix'); mix .
Read more >
NPM Run Development. ENOENT: no such file or directory
Fixed. just need to follow the path mix is looking for. changed my webpack.mix.js sass('resources/assets/sass/desktop.scss', ...
Read more >
Error: ENOENT: no such file or directory, open '/css/app.css'
I'm using standalone version of laravel-mix@1.6.1 with npm@5.5.1 and I'm only compiling scss file: let mix = require('laravel-mix'); mix .
Read more >
Can't get Laravel Mix to work - Frustration LIMIT reached
I got an error when running npm run dev that UIKIT is missing and not in the node_modules ... Module build failed: Error:...
Read more >
Laravel mix copy `no such file or directory` - Reddit
I have a standalone installation of laravel mix for a shopify project. When using the copy method I get an [Error: ENOENT: no...
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