Cannot read property common of undefined
See original GitHub issueEverytime I run npm run watch
and it detects changes I receive the error
unknown property commons of undefined
which is refering to
window.axios = require('axios');
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
My dependencies
"axios": "^0.16.2",
"cross-env": "^5.0.1",
"jquery": "^3.1.1",
"laravel-mix": "^1.0",
"vue": "^2.1.10",
"less": "^2.7.2",
"less-loader": "^4.0.5"
I’m working with a fresh laravel installation on a windows machine.
Steps To Reproduce:
- run
npm run watch
- make a change to a vue or less file
- reload page
It’s working perfectly fine with npm run dev
It also seems like the watcher tries to run multiple times. I receive a lot of notifications about the buld success.
Update
Working when chaning laravel-mix version to 0.*
Already described in #1120
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:20 (2 by maintainers)
Top Results From Across the Web
Laravel 5.4 Uncaught TypeError: Cannot read property ...
Laravel 5.4 Uncaught TypeError: Cannot read property 'common' of undefined - Stack Overflow. Stack Overflow for Teams – Start collaborating and ...
Read more >Cannot read property common of undefined #1148 - GitHub
I'm working with a fresh laravel installation on a windows machine. Steps To Reproduce: run npm run watch; make a change to a...
Read more >Cannot Read Property of Undefined in JavaScript - Rollbar
What Causes TypeError: Cannot Read Property of Undefined ... Undefined means that a variable has been declared but has not been assigned a...
Read more >Uncaught TypeError: Cannot read property of undefined In
JavaScript TypeError is thrown when an operand or argument passed to a function is incompatible with the type expected by that operator or...
Read more >Cannot read property of undefined in JavaScript - Stack Diary
The Cannot read property '<property>' of undefined error is thrown when you try to access a property of an undefined value. This typically ......
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
Based on #1120’s error
Change this:
to
Experiencing seemingly the same symptoms here. This was happening with Laravel 5.4 and is now happening in 5.5. This is on a Mac using Valet. This is with fresh installs of either.
What I have observed:
npm run watch
the entire time.I have not tried to kill and restart the npm process like others have. Instead, what I have found to ‘fix’ the issue is to (re)save a .vue file a couple of times. I can save the same .vue file 2-4 times or save 2-4 separate .vue files and then the page loads without error. So it doesn’t appear to care what is saved as long as it’s a .vue file, and it needs a few saves to fly straight again.
That said, those details sound like untroubleshot technical voodoo. But, I’ve seen this specific issue and workaround stay consistent for the last several months.
I am ignorant as to what information about my system might be helpful, but I’m more than happy to produce any details that would help.