JanWeskamp's avatar

Laravel Mix created js files in wrong directory (Laravel 5.4)

I store my assets in /storage/app/public/(css/js/img) But if I compile my js for example in /storage/app/public/js it is published in /storage/app//js what is the problem here??

mix.js('resources/assets/js/app.js', '../storage/app/public/js/app.js');->Works but file is published there ->/storage/app//js

mix.js('resources/assets/js/app.js', 'storage/app/public/js/app.js'); ->Doesn't work .... Error below

...
 94% asset optimization
 95% emittingError: EEXIST: file already exists, mkdir '/Users/janweskamp/PhpstormProjects/laravel-test/public/storage'

npm ERR! Darwin 16.5.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/bin/npm-cli.js" "run" "dev"
npm ERR! node v7.6.0
npm ERR! npm  v4.1.2
npm ERR! code ELIFECYCLE
npm ERR! @ dev: `node node_modules/cross-env/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the @ dev script 'node node_modules/cross-env/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --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  package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node node_modules/cross-env/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --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 
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls 
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/janweskamp/PhpstormProjects/laravel-test/npm-debug.log
0 likes
6 replies
JanWeskamp's avatar

EDIT I already upgraded to latest laravel-mix 0.8.1

WebKenth's avatar

Just curious, why arn't you storing your ASSETS in the ASSETS folder?

Storage is for storing uploaded content and the likes, not for storing your development content.

JanWeskamp's avatar

At this moments my assets are stored in the ASSETS folder. ;)

It is just a test and a failure of laravel-mix I think. css files are placed in the right dir /storage/app/public/css/ js files aren't placed in the right dir /storage/app/public/js/

dont worry ;)

codenex's avatar
codenex
Best Answer
Level 7

I don't get the error you posted when running npm run dev using the same syntax you did. However, I do see that it posts to storage/app//js/app.js

So could be a bug, but then again I don't think it was anticipated to use this storage location....

1 like

Please or to participate in this conversation.