Error when version function is present: no such file or directory, open '/dist/js/app.js'
See original GitHub issue- Laravel Mix Version: ^1.0.7
- Node Version: v6.11.0
- NPM Version: 3.10.10
- OS: Mac OS 10.10.5 (Yosemite)
Description:
I just started a fresh project and when I use the version()
function I get this error telling me that no such file or directory, open '/dist/js/app.js'
but as you can see in the image the files and the directory are present but if I remove the version()
everything works fine.
Error
➜danny: ~/Documents/Projects/my-app npm run watch
> laravel-app@1.0.0 watch /Users/danny/Documents/Projects/my-app
> NODE_ENV=development webpack --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
10% building modules 1/1 modules 0 active
Webpack is watching the files…
95% emitting
DONE Compiled successfully in 12950ms 9:17:58 PM
fs.js:641
return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
^
Error: ENOENT: no such file or directory, open '/dist/js/app.js'
at Error (native)
at Object.fs.openSync (fs.js:641:18)
at Object.fs.readFileSync (fs.js:509:33)
at File.read (/Users/danny/Documents/Projects/my-app/node_modules/laravel-mix/src/File.js:180:19)
at File.version (/Users/danny/Documents/Projects/my-app/node_modules/laravel-mix/src/File.js:190:25)
at Manifest.hash (/Users/danny/Documents/Projects/my-app/node_modules/laravel-mix/src/Manifest.js:55:65)
at manifest.forEach.file (/Users/danny/Documents/Projects/my-app/node_modules/laravel-mix/src/plugins/CustomTasksPlugin.js:79:47)
at Array.forEach (native)
at CustomTasksPlugin.applyVersioning (/Users/danny/Documents/Projects/my-app/node_modules/laravel-mix/src/plugins/CustomTasksPlugin.js:79:18)
at Compiler.compiler.plugin.stats (/Users/danny/Documents/Projects/my-app/node_modules/laravel-mix/src/plugins/CustomTasksPlugin.js:12:22)
at Compiler.applyPlugins (/Users/danny/Documents/Projects/my-app/node_modules/tapable/lib/Tapable.js:61:14)
at Watching._done (/Users/danny/Documents/Projects/my-app/node_modules/webpack/lib/Compiler.js:100:16)
at /Users/danny/Documents/Projects/my-app/node_modules/webpack/lib/Compiler.js:75:18
at Compiler.emitRecords (/Users/danny/Documents/Projects/my-app/node_modules/webpack/lib/Compiler.js:369:37)
at /Users/danny/Documents/Projects/my-app/node_modules/webpack/lib/Compiler.js:58:19
at /Users/danny/Documents/Projects/my-app/node_modules/webpack/lib/Compiler.js:362:11
at next (/Users/danny/Documents/Projects/my-app/node_modules/tapable/lib/Tapable.js:154:11)
at Compiler.compiler.plugin (/Users/danny/Documents/Projects/my-app/node_modules/webpack/lib/performance/SizeLimitsPlugin.js:99:4)
at Compiler.applyPluginsAsyncSeries1 (/Users/danny/Documents/Projects/my-app/node_modules/tapable/lib/Tapable.js:158:13)
at Compiler.afterEmit (/Users/danny/Documents/Projects/my-app/node_modules/webpack/lib/Compiler.js:359:8)
at Compiler.<anonymous> (/Users/danny/Documents/Projects/my-app/node_modules/webpack/lib/Compiler.js:354:14)
at /Users/danny/Documents/Projects/my-app/node_modules/async/dist/async.js:421:16
at iteratorCallback (/Users/danny/Documents/Projects/my-app/node_modules/async/dist/async.js:998:13)
at /Users/danny/Documents/Projects/my-app/node_modules/async/dist/async.js:906:16
at /Users/danny/Documents/Projects/my-app/node_modules/graceful-fs/graceful-fs.js:43:10
at FSReqWrap.oncomplete (fs.js:123:15)
npm ERR! Darwin 14.5.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "watch"
npm ERR! node v6.11.0
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! laravel-app@1.0.0 watch: `NODE_ENV=development webpack --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the laravel-app@1.0.0 watch script 'NODE_ENV=development webpack --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the laravel-app package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! NODE_ENV=development webpack --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs laravel-app
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls laravel-app
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/danny/Documents/Projects/my-app/npm-debug.log
Steps To Reproduce:
- Create fresh project and run
mkdir src
touch src/app.js src/app.scss
- In your
webpack.config
mix.js('src/app.js', 'dist/js')
.sass('src/app.scss', 'dist/css')
.version();
- run
NODE_ENV=development webpack --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
Issue Analytics
- State:
- Created 6 years ago
- Comments:5
Top Results From Across the Web
How to resolve Nodejs: Error: ENOENT: no such file or directory
Your app is expecting to find a file at /home/embah/node/nodeapp/config/config.json but that file does not exist (which is what ENOENT ...
Read more >async - Documentation - GitHub Pages
A collection of async functions for manipulating collections, such as arrays and ... [ Error: ENOENT: no such file or directory ] //...
Read more >File processing in Node.js: A comprehensive guide
In this guide, walk through file processing in Node.js, from handling files and editing metadata to working with links and directories.
Read more >Strict mode - JavaScript - MDN Web Docs
JavaScript's strict mode is a way to opt in to a restricted variant of JavaScript, thereby implicitly opting-out of "sloppy mode".
Read more >CoffeeScript
The command-line version of coffee is available as a Node.js utility, requiring Node 6 or later. The core compiler however, does not depend...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Update
Adding
mix.setPublicPath('./')
at the top of your webpack.mix.js file fix the issueAdded
mix.setPublicPath('./')
to webpack.mix.js and now mix-manifest.json file not in ./public