link2192 link2193 link2194 link2195 link2196 link2197 link2198 link2199 link2200 link2201 link2202 link2203 link2204 link2205 link2206 link2207 link2208 link2209 link2210 link2211 link2212 link2213 link2214 link2215 link2216 link2217 link2218 link2219 link2220 link2221 link2222 link2223 link2224 link2225 link2226 link2227 link2228 link2229 link2230 link2231 link2232 link2233 link2234 link2235 link2236 link2237 link2238 link2239 link2240 link2241 link2242 link2243 link2244 link2245 link2246 link2247 link2248 link2249 link2250 link2251 link2252 link2253 link2254 link2255 link2256 link2257 link2258 link2259 link2260 link2261 link2262 link2263 link2264 link2265 link2266 link2267 link2268 link2269 link2270 link2271 link2272 link2273 link2274 link2275 link2276 link2277 link2278 link2279 link2280 link2281 link2282 link2283 link2284 link2285 link2286 link2287 link2288 link2289 link2290 link2291 link2292 link2293 link2294 link2295 link2296 link2297 link2298 link2299 link2300 link2301 link2302 link2303 link2304 link2305 link2306 link2307 link2308 link2309 link2310 link2311 link2312 link2313 link2314 link2315 link2316 link2317 link2318 link2319 link2320 link2321 link2322 link2323 link2324 link2325 link2326 link2327 link2328

[Vue.js] Cannot read property 'upgrade' of undefined when starting vue application

there is a project that’s been running perfectly for a few months now, able to run npm run serve with no problem. there is to terminate and run the command again whenever I switch networks, but that has never been a problem and the server could always start again.

Until now - no matter what I do I can’t get the server to start. I get this error:

npm run serve

\> xbs@0.6.2 serve D:\workspace\[PROJECT]
\> vue-cli-service serve

INFO Starting development server…
10% building 1/1 modules 0 active ERROR TypeError: Cannot read property ‘upgrade’ of undefined
TypeError: Cannot read property ‘upgrade’ of undefined
at Server.<anonymous> (D:\workspace\[PROJECT]\node_modules\webpack-dev-server\lib\Server.js:667:47)
at Array.forEach (<anonymous>)
at new Server (D:\workspace\[PROJECT]\node_modules\webpack-dev-server\lib\Server.js:666:22)
at serve (D:\workspace\[PROJECT]\node_modules\@vue\cli-service\lib\commands\serve.js:137:20)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
at Function.Module.runMain (module.js:695:11)
at startup (bootstrap_node.js:191:16)
at bootstrap_node.js:612:3

The last time I got this message was when I forgot to set the .env files, but this is a previously working copy with all necessary files set, and no changes since the last working run.

I’ve even tried pulling a fresh copy of the repo, running npm i and setting all env files but it still fails.

npm run lint and npm run build can still work, only npm run serve.

Am I missing anything?

Solution :

The problem was again with the .env files. My vue.config.js was trying to access a previously set environment variable that had since been removed.

Only strange thing was that there weren’t any problems up til now?