question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[vite-plugin-svelte-kit] Cannot read properties of undefined (reading 'paths') error during build

See original GitHub issue

Describe the bug

When running npm run build this appears:

[vite-plugin-svelte-kit] Cannot read properties of undefined (reading 'paths') error during build

The cause is having a file with the same name and .js and .ts extensions in the same directory.

This took me three hours of my time to figure out, and I could not find a single answer anywhere online. I had to switch branches, stash, manually cut and paste hundreds of files, all because this error message was shown.

If we could instead show something along the lines of "Cannot have duplicate file names: {path/to/files}{filename} "

Reproduction

The cause is having a file with the same name and .js and .ts extensions in the same directory.

Logs

No response

System Info

Windows 10

Severity

annoyance

Additional Information

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:8
  • Comments:23 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
Mopholocommented, Jul 14, 2022

It seems like there a number of causes for this message, but basically it’s just hiding the details that were displayed properly extra-vite integration

As far as imports

import {someFunction} from 'someFile'

It gets that message if import someFunction is not exported in someFile It gets that message if someFile ( or the path ) is not correct or missing

Oddly it won’t throw an error on build when someFunction is not in someFile

There are other odd ones this error catches I have not been able to explain.

2reactions
justingolden21commented, Jul 14, 2022

I believe I had a bad import path somewhere else that fixed it as well.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot read properties of undefined (reading 'pathname')
I am getting the following text on the index page when deploying on production but when I run npm run build and npm...
Read more >
TypeError: Cannot read properties of undefined (reading 'path ...
I am building a blog web app to post and edit using Node.js. It seems to work when I update an image and...
Read more >
TypeError: Cannot read properties of undefined (re...
my client script.
Read more >
Uncaught typeerror: cannot read properties of undefined ...
Usually this means a variable that you're referencing has a value of undefined when you try to read the property (as the error...
Read more >
IFS Cloud - Open Detail - Error - Problem with navigator
Found problem with transferring navigator path to Detail (maybe position of ... Error stack: Cannot read properties of undefined (reading ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found