Any call to npm run after upgrading to Mix v4.x results in mix being undefined. I see errors like this on every run:
> npm run development
> # development /project
> cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
/project/node_modules/webpack-cli/bin/cli.js:235
throw err;
^
TypeError: Cannot read property 'js' of undefined
at Object.<anonymous> (/project/webpack.mix.js:15:5)
at Module._compile (/project/node_modules/v8-compile-cache/v8-compile-cache.js:178:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:732:10)
at Module.load (internal/modules/cjs/loader.js:620:32)
at tryModuleLoad (internal/modules/cjs/loader.js:560:12)
at Function.Module._load (internal/modules/cjs/loader.js:552:3)
at Module.require (internal/modules/cjs/loader.js:657:17)
at require (/project/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
at Object.<anonymous> (/project/node_modules/laravel-mix/setup/webpack.config.js:12:1)
at Module._compile (/project/node_modules/v8-compile-cache/v8-compile-cache.js:178:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:732:10)
at Module.load (internal/modules/cjs/loader.js:620:32)
at tryModuleLoad (internal/modules/cjs/loader.js:560:12)
at Function.Module._load (internal/modules/cjs/loader.js:552:3)
at Module.require (internal/modules/cjs/loader.js:657:17)
at require (/project/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
at WEBPACK_OPTIONS (/project/node_modules/webpack-cli/bin/convert-argv.js:113:13)
at requireConfig (/project/node_modules/webpack-cli/bin/convert-argv.js:115:6)
at /project/node_modules/webpack-cli/bin/convert-argv.js:122:17
at Array.forEach (<anonymous>)
at module.exports (/project/node_modules/webpack-cli/bin/convert-argv.js:120:15)
at yargs.parse (/project/node_modules/webpack-cli/bin/cli.js:232:39)
at Object.parse (/project/node_modules/yargs/yargs.js:567:18)
at /project/node_modules/webpack-cli/bin/cli.js:210:8
at Object.<anonymous> (/project/node_modules/webpack-cli/bin/cli.js:500:3)
at Module._compile (internal/modules/cjs/loader.js:721:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:732:10)
at Module.load (internal/modules/cjs/loader.js:620:32)
at tryModuleLoad (internal/modules/cjs/loader.js:560:12)
at Function.Module._load (internal/modules/cjs/loader.js:552:3)
at Module.require (internal/modules/cjs/loader.js:657:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.<anonymous> (/project/node_modules/webpack/bin/webpack.js:155:2)
at Module._compile (internal/modules/cjs/loader.js:721:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:732:10)
at Module.load (internal/modules/cjs/loader.js:620:32)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # development: `cross-env 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 # development script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
I'm running this with Laravel 5.5. I upgraded package.json to match the version in the laravel repo that is used with mix v4.
Here is my 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": "npm run development -- --watch",
"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 --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"devDependencies": {
"accounting": "^0.4.1",
"axios": "^0.18.0",
"bootstrap": "^4.1.3",
"bootstrap-sass": "^3.4.0",
"cross-env": "^5.2.0",
"fancybox": "^3.0.1",
"jquery": "^3.3.1",
"jquery-slimscroll": "^1.3.8",
"ladda": "^2.0.1",
"laravel-mix": "^4.0.13",
"locutus": "^2.0.10",
"metismenu": "^2.7.9",
"moment": "^2.23.0",
"vue": "^2.5.21",
"webpack": "^4.28.3",
"webpack-cli": "^3.2.0"
},
"dependencies": {
"ajv": "^6.6.2",
"bootstrap-vue": "^2.0.0-rc.11",
"extract-text-webpack-plugin": "^4.0.0-beta.0",
"imagemin": "^6.0.0",
"jsonexport": "^2.4.1",
"laravel-echo": "^1.5.2",
"lodash": "^4.17.11",
"node-sass": "^4.11.0",
"pusher-js": "^4.3.1",
"sweetalert2": "^7.32.4",
"vue-api-query": "^1.2.0",
"vue-events": "^3.1.0",
"vue-multiselect": "^2.1.3",
"vue-sweetalert2": "^1.6.3",
"vuetable-2": "^2.0.0-beta.4",
"vuex": "^3.0.1"
}
}
My webpack.mix.js:
const { mix } = require('laravel-mix');
mix.js('resources/assets/js/app.js', 'public/js')
.sass('resources/assets/sass/app.scss', 'public/css')
.version()
.sourceMaps();
I've tried deleting node_modules and yarn install again but that doesn't fix it.
If I downgrade to v3, there are no issues other than problems compiling some SASS.
npm v6.4.1
node v11.5.0
yarn v1.12.3
Without seeing your webpack.mix.js file it's hard to say what the problem could be. I cloned the Laravel 5.5 branch and upgraded to version ^4.0.13 of laravel-mix and successfully ran both yarn dev and yarn prod, although I am using more recent versions of npm and node.
NPM 6.5.0-next.0
Node 11.6.0
Yarn 1.12.3
Here's a GitHub repo to demo.
Update
// TypeError: Cannot read property 'js' of undefined
const { mix } = require('laravel-mix');
// works
const mix = require('laravel-mix');
Related
i'm receiving this error whenever i try to run npm run dev
npm run development
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
> development
> cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --config=node_modules/laravel-mix/setup/webpack.config.js
[webpack-cli] TypeError: Cannot redefine property: tap
at Function.defineProperty (<anonymous>)
at Object.<anonymous> (C:\Users\dell\Downloads\fay\Modules\Votes\node_modules\laravel-mix\src\helpers.js:21:8)
at Module._compile (node:internal/modules/cjs/loader:1105:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (C:\Users\dell\Downloads\fay\Modules\Votes\node_modules\laravel-mix\src\index.js:16:1)
at Module._compile (node:internal/modules/cjs/loader:1105:14)
My package.json
"scripts": {
"rtlcss": "rtlcss",
"postinstall": "lerna bootstrap",
"dev": "npm run development",
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "npm run development -- --watch",
"watch-poll": "npm run watch -- --watch-poll",
"prod": "npm run production",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"devDependencies": {
"#babel/preset-env": "^7.16.4",
"cross-env": "^6.0.3",
"eslint": "^4.9.0",
"eslint-config-spatie": "^2.0.3",
"eslint-plugin-import": "^2.7.0",
"glob": "^7.1.2",
"laravel-mix": "^6.0.39",
"laravel-mix-merge-manifest": "^0.1.2",
"lerna": "^2.9.0",
"rtlcss": "^2.4.0",
"sass": "^1.25.0",
"sass-loader": "^8.0.2",
"vue-template-compiler": "^2.6.11",
"webpack-shell-plugin": "^0.5.0"
},
"dependencies": {
"webpack": "^5.74.0",
"yarn": "^1.22.19"
}
}
a suggested solution on Laravel-mix github is to change versions but that didn't solve it for me. any reason for that error?
i also delete node_module and package_lock.json and again run
npm install
but it still same
i'm receiving this error whenever i try to run npm run dev
[webpack-cli] TypeError: Cannot redefine property: tap
at Function.defineProperty (<anonymous>)
at Object.<anonymous> (C:\xampp\htdocs\Themes\Storefront\node_modules\laravel-mix\src\helpers.js:21:8)
at Module._compile (C:\xampp\htdocs\node_modules\v8-compile-cache\v8-compile-cache.js:192:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (C:\xampp\htdocs\node_modules\v8-compile-cache\v8-compile-cache.js:159:20)
at Object.<anonymous> (C:\xampp\htdocs\Themes\Storefront\node_modules\laravel-mix\src\index.js:3:1)
at Module._compile (C:\xampp\htdocs\node_modules\v8-compile-cache\v8-compile-cache.js:192:30)
my package.json file
"scripts": {
"rtlcss": "rtlcss",
"postinstall": "lerna bootstrap",
"dev": "npm run development",
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "npm run development -- --watch",
"watch-poll": "npm run watch -- --watch-poll",
"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": {
"cross-env": "^6.0.2",
"eslint": "^4.9.0",
"eslint-config-spatie": "^2.0.3",
"eslint-plugin-import": "^2.7.0",
"glob": "^7.1.2",
"laravel-mix": "^6.0.13",
"laravel-mix-merge-manifest": "^0.1.2",
"lerna": "^4.0.0",
"postcss": "8.1",
"rtlcss": "^2.4.0",
"sass": "^1.25.0",
"sass-loader": "^8.0.2",
"vue-template-compiler": "^2.6.11",
"webpack-dev-server": "^3.11.2",
"webpack-shell-plugin": "^0.5.0"
},
"dependencies": {
"schema-utils": "^3.0.0",
"webpack": "^5.24.2",
"webpack-cli": "^4.5.0"
}
a suggested solution on Laravel-mix github is to change versions but that didn't solve it for me. any reason for that error?
I have problems with URL Processing in Laravel mix.
here is my app.css
#import 'tailwindcss/base';
#import 'tailwindcss/components';
#import 'tailwindcss/utilities';
/*---------- import LightGallery from node_modules ----------*/
#import 'lightgallery.js';
/*---------- my styles for thumbnails ----------*/
#import 'includes/thumbnails';
here is my webpack.mix.js
const mix = require('laravel-mix');
mix.js('resources/js/app.js', 'public/js')
.scripts([
'public/js/app.js',
'resources/js/includes/script.js'
], 'public/js/app.js')
.postCss('resources/css/app.css', 'public/css', [
require('postcss-import'),
require('tailwindcss'),
require('postcss-extend'),
require('postcss-nested'),
require('autoprefixer'),
]);
package.json
{
"private": true,
"scripts": {
"dev": "npm run development",
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "npm run development -- --watch",
"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 --disable-host-check --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 --no-progress --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"devDependencies": {
"#tailwindcss/forms": "^0.2.1",
"alpinejs": "^2.7.3",
"autoprefixer": "^9.8.6",
"axios": "^0.19",
"cross-env": "^7.0",
"laravel-mix": "^5.0.1",
"lodash": "^4.17.19",
"postcss": "^8.2.6",
"postcss-extend": "^1.0.5",
"postcss-import": "^12.0.1",
"postcss-simple-extend": "^1.0.0",
"postcss-simple-vars": "^6.0.3",
"resolve-url-loader": "^3.1.0",
"sass": "^1.32.7",
"sass-loader": "^8.0.2",
"tailwindcss": "npm:#tailwindcss/postcss7-compat#^2.0.1",
"vue-template-compiler": "^2.6.12"
},
"dependencies": {
"#tkh/tailwind-plugin-flex-basis": "^1.4.0",
"lightgallery.js": "^1.4.0",
"npm": "^7.3.0"
}
}
And if I do npm run dev I see following error. It seems that fonts and images from node_modules/lightgallery.js/dist don't copied by laravel mix
> dev
> npm run development
> development
> cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --config=node_modules/laravel-mix/setup/webpack.config.js
98% after emitting SizeLimitsPlugin
ERROR Failed to compile with 7 errors 9:06:04 PM
These relative modules were not found:
* ../fonts/lg.svg?22t19m in ./node_modules/css-loader??ref--5-2!./node_modules/postcss-loader/src??postcss0!./resources/css/app.css
* ../fonts/lg.ttf?22t19m in ./node_modules/css-loader??ref--5-2!./node_modules/postcss-loader/src??postcss0!./resources/css/app.css
* ../fonts/lg.woff?22t19m in ./node_modules/css-loader??ref--5-2!./node_modules/postcss-loader/src??postcss0!./resources/css/app.css
* ../img/loading.gif in ./node_modules/css-loader??ref--5-2!./node_modules/postcss-loader/src??postcss0!./resources/css/app.css
* ../img/video-play.png in ./node_modules/css-loader??ref--5-2!./node_modules/postcss-loader/src??postcss0!./resources/css/app.css
* ../img/vimeo-play.png in ./node_modules/css-loader??ref--5-2!./node_modules/postcss-loader/src??postcss0!./resources/css/app.css
* ../img/youtube-play.png in ./node_modules/css-loader??ref--5-2!./node_modules/postcss-loader/src??postcss0!./resources/css/app.css
Asset Size Chunks Chunk Names
/js/app.js 730 KiB /js/app [emitted] /js/app
ERROR in ./resources/css/app.css
Module build failed (from ./node_modules/css-loader/index.js):
ModuleNotFoundError: Module not found: Error: Can't resolve '../fonts/lg.svg?22t19m' in '/home/http/app/resources/css'
at /home/http/app/node_modules/webpack/lib/Compilation.js:925:10
at /home/http/app/node_modules/webpack/lib/NormalModuleFactory.js:401:22
at /home/http/app/node_modules/webpack/lib/NormalModuleFactory.js:130:21
at /home/http/app/node_modules/webpack/lib/NormalModuleFactory.js:224:22
at /home/http/app/node_modules/neo-async/async.js:2830:7
at /home/http/app/node_modules/neo-async/async.js:6877:13
at /home/http/app/node_modules/webpack/lib/NormalModuleFactory.js:214:25
at /home/http/app/node_modules/enhanced-resolve/lib/Resolver.js:213:14
at /home/http/app/node_modules/enhanced-resolve/lib/Resolver.js:285:5
at eval (eval at create (/home/http/app/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
at /home/http/app/node_modules/enhanced-resolve/lib/UnsafeCachePlugin.js:44:7
at /home/http/app/node_modules/enhanced-resolve/lib/Resolver.js:285:5
at eval (eval at create (/home/http/app/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
at /home/http/app/node_modules/enhanced-resolve/lib/Resolver.js:285:5
at eval (eval at create (/home/http/app/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:27:1)
at /home/http/app/node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js:67:43
at /home/http/app/node_modules/enhanced-resolve/lib/Resolver.js:285:5
at eval (eval at create (/home/http/app/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:16:1)
at /home/http/app/node_modules/enhanced-resolve/lib/Resolver.js:285:5
at eval (eval at create (/home/http/app/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:27:1)
at /home/http/app/node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js:67:43
at /home/http/app/node_modules/enhanced-resolve/lib/Resolver.js:285:5
at eval (eval at create (/home/http/app/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:16:1)
at /home/http/app/node_modules/enhanced-resolve/lib/Resolver.js:285:5
at eval (eval at create (/home/http/app/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
at /home/http/app/node_modules/enhanced-resolve/lib/DirectoryExistsPlugin.js:27:15
at /home/http/app/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:85:15
at processTicksAndRejections (node:internal/process/task_queues:75:11)
# ./resources/css/app.css
ERROR in ./resources/css/app.css (./node_modules/css-loader??ref--5-2!./node_modules/postcss-loader/src??postcss0!./resources/css/app.css)
Module not found: Error: Can't resolve '../fonts/lg.svg?22t19m' in '/home/http/app/resources/css'
# ./resources/css/app.css (./node_modules/css-loader??ref--5-2!./node_modules/postcss-loader/src??postcss0!./resources/css/app.css) 7:1351805-1351838
# ./resources/css/app.css
ERROR in ./resources/css/app.css (./node_modules/css-loader??ref--5-2!./node_modules/postcss-loader/src??postcss0!./resources/css/app.css)
Module not found: Error: Can't resolve '../fonts/lg.ttf?22t19m' in '/home/http/app/resources/css'
# ./resources/css/app.css (./node_modules/css-loader??ref--5-2!./node_modules/postcss-loader/src??postcss0!./resources/css/app.css) 7:1351654-1351687
# ./resources/css/app.css
ERROR in ./resources/css/app.css (./node_modules/css-loader??ref--5-2!./node_modules/postcss-loader/src??postcss0!./resources/css/app.css)
Module not found: Error: Can't resolve '../fonts/lg.woff?22t19m' in '/home/http/app/resources/css'
# ./resources/css/app.css (./node_modules/css-loader??ref--5-2!./node_modules/postcss-loader/src??postcss0!./resources/css/app.css) 7:1351731-1351765
# ./resources/css/app.css
ERROR in ./resources/css/app.css (./node_modules/css-loader??ref--5-2!./node_modules/postcss-loader/src??postcss0!./resources/css/app.css)
Module not found: Error: Can't resolve '../img/loading.gif' in '/home/http/app/resources/css'
# ./resources/css/app.css (./node_modules/css-loader??ref--5-2!./node_modules/postcss-loader/src??postcss0!./resources/css/app.css) 7:1368504-1368533
# ./resources/css/app.css
ERROR in ./resources/css/app.css (./node_modules/css-loader??ref--5-2!./node_modules/postcss-loader/src??postcss0!./resources/css/app.css)
Module not found: Error: Can't resolve '../img/video-play.png' in '/home/http/app/resources/css'
# ./resources/css/app.css (./node_modules/css-loader??ref--5-2!./node_modules/postcss-loader/src??postcss0!./resources/css/app.css) 7:1359119-1359151
# ./resources/css/app.css
ERROR in ./resources/css/app.css (./node_modules/css-loader??ref--5-2!./node_modules/postcss-loader/src??postcss0!./resources/css/app.css)
Module not found: Error: Can't resolve '../img/vimeo-play.png' in '/home/http/app/resources/css'
# ./resources/css/app.css (./node_modules/css-loader??ref--5-2!./node_modules/postcss-loader/src??postcss0!./resources/css/app.css) 7:1358797-1358829 7:1358953-1358985
# ./resources/css/app.css
ERROR in ./resources/css/app.css (./node_modules/css-loader??ref--5-2!./node_modules/postcss-loader/src??postcss0!./resources/css/app.css)
Module not found: Error: Can't resolve '../img/youtube-play.png' in '/home/http/app/resources/css'
# ./resources/css/app.css (./node_modules/css-loader??ref--5-2!./node_modules/postcss-loader/src??postcss0!./resources/css/app.css) 7:1359422-1359456 7:1359582-1359616
# ./resources/css/app.css
But if I do the same job with sass instead postCss everything working.
Here is my working code, but I want to get rid of sass and replace all with postCSS plugins
/resources/css/app.css
#import 'tailwindcss/base';
#import 'tailwindcss/components';
#import 'tailwindcss/utilities';
#import 'includes/thumbnails';
/resources/sass/app.scss
#import '~lightgallery.js/src/sass/lightgallery';
/* postcss-mixin plugin also doesn't work in my mix file */
#import 'mixins/svg';
webpack.mix.js
const mix = require('laravel-mix');
mix.js('resources/js/app.js', 'public/js')
.scripts([
'public/js/app.js',
'resources/js/includes/script.js'
], 'public/js/app.js')
.sass('resources/sass/app.scss', 'public/css')
.styles([
'resources/css/app.css',
'public/css/app.css'
],'public/css/app.css')
.postCss('public/css/app.css', 'public/css', [
require('postcss-import'),
require('tailwindcss'),
require('postcss-extend'),
require('postcss-nested'),
require('autoprefixer'),
]);
Try it in
webpack.mix.js.
install webpack-livereload-plugin with npm
var LiveReloadPlugin = require('webpack-livereload-plugin');
mix.webpackConfig({
plugins: [new LiveReloadPlugin()],
stats: {
children: true
}
});
First, in webpack.mix.js, do you need the SASS line? Because it's causing issues.
.sass('resources/sass/app.scss', 'public/css')
Ensure the tilde is present to reference the node_modules/ directory in your app.css for lightgallery.js and use the full CSS path.
#import '~lightgallery.js/dist/css/lightgallery.min.css';
Update Node dependencies for Laravel Mix 6, Webpack, Autoprefixer, and PostCSS and update the "scripts" section of package.json to the following.
{
"private": true,
"scripts": {
"dev": "npm run development",
"development": "mix",
"watch": "mix watch",
"watch-poll": "mix watch -- --watch-options-poll=1000",
"hot": "mix watch --hot",
"prod": "npm run production",
"production": "mix --production"
},
"devDependencies": {
"#tailwindcss/forms": "^0.2.1",
"#tkh/tailwind-plugin-flex-basis": "^1.4.0",
"alpinejs": "^2.8.0",
"autoprefixer": "^10.2.4",
"axios": "^0.21",
"cross-env": "^7.0",
"laravel-mix": "^6.0.11",
"lightgallery.js": "^1.4.0",
"lodash": "^4.17.20",
"postcss": "^8.2.6",
"postcss-extend": "^1.0.5",
"postcss-import": "^8.2.0",
"postcss-simple-extend": "^1.0.0",
"postcss-simple-vars": "^6.0.3",
"resolve-url-loader": "^3.1.0",
"sass": "^1.32.8",
"sass-loader": "^9.0.3",
"tailwindcss": "2.0.3",
"vue-template-compiler": "^2.6.12",
"webpack": "^5.23.0"
}
}
Then run npm update && npm install.
Now you can run npm run dev.
Some packages of laravel 5 such Spoon can with a package.json and when run yarn get error
yarn install v1.3.2
[1/4] 🔍 Resolving packages...
[2/4] 🚚 Fetching packages...
error An unexpected error occurred: "https://registry.yarnpkg.com/webpack-dev-server/-/webpack-dev-server-2.7.0.tgz: Request failed \"404 Not Found\"".
info If you think this is a bug, please open a bug report with the information provided in "/Users/abkrim/Sites/spoon/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
I see a regresion of version 2.7.0 of webpack-dev-server. Only possible use 2.7.1 or up.
I read my package.json
{
"private": true,
"scripts": {
"css-lint": "stylelint \"resources/assets/css/**/*.css\" --fix",
"js-lint": "eslint resources/assets/js --ext .js,.vue --fix && exit 0",
"dev": "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",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"dependencies": {
"axios": "^0.16.2",
"babel-plugin-syntax-dynamic-import": "^6.18.0",
"babel-plugin-transform-object-rest-spread": "^6.23.0",
"babel-polyfill": "^6.23.0",
"babel-preset-env": "^1.6.0",
"eslint": "^4.3.0",
"eslint-config-spatie": "^2.0.1",
"jest": "^20.0.4",
"laravel-mix": "^1.4",
"lodash": "^4.17.4",
"postcss-cli": "^4.1.0",
"postcss-cssnext": "^3.0.2",
"postcss-easy-import": "^2.1.0",
"stylelint": "^8.0.0",
"stylelint-config-standard": "^17.0.0",
"vue": "^2.4.0"
},
"devDependencies": {
"cross-env": "^5.1.1",
"webpack-dev-server": "^2.9.4"
}
}
Any way for solution this headache?
Try this command ?
yarn add -D webpack-dev-server#2.9.4
I get this error when I try to use gulp in my Laravel project. I tried deleting node_modules and running npm install, but no lock.
λ gulp
module.js:471
throw err;
^
Error: Cannot find module 'laravel-elixir-vue-2'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (C:\wamp64\www\ibpc\gulpfile.js:3:1)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
I also tried to add it to package.json.
package.json
{
"private": true,
"scripts": {
"prod": "gulp --production",
"dev": "gulp watch"
},
"devDependencies": {
"bootstrap-sass": "^3.3.7",
"gulp": "^3.9.1",
"jquery": "^3.1.0",
"laravel-elixir": "^6.0.0-9",
"laravel-elixir-webpack-official": "^1.0.2",
"lodash": "^4.16.2",
"vue": "^2.0.1",
"vue-resource": "^1.0.3"
}
}
Any ideas?
Probably, you don't have laravel-elixir-vue-2 in your package.json file.
Try to install package with the next command:
npm install laravel-elixir-vue-2 --save-dev
Or add in your package.json this line:
"laravel-elixir-vue-2": "^0.3.0"
I've got same problem.
I tried to run this command
npm install laravel-elixir-webpack-official
And it fixed...