Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Ngozistephen's avatar

Error when Importing Composable / locations

Hello, i have an error when importing my composable/ location file

import useLocations from '../../composables/locations.js'

Here is the Error [vite] Internal server error: Failed to resolve import "../../composables/locations.js" from "resources\js\components\Properties\index.vue". Does the file exist?

0 likes
4 replies
LaryAI's avatar
Level 58

The error message suggests that the file "locations.js" cannot be found. Double-check that the file exists in the correct directory and that the file name is spelled correctly.

If the file exists and is spelled correctly, try using a relative path from the root directory instead of from the current file's directory. For example, if the root directory is "src", the import statement would be:

import useLocations from '@/composables/locations.js'

Note the "@" symbol, which is a shortcut for the root directory.

If the issue persists, try restarting your development server or clearing your cache.

1 like
Ngozistephen's avatar

@LaryAI still showing same error message Failed to load url /resources/js/composables/locations.js (resolved id: /resources/js/composables/locations.js) in C:/laragon/www/RealEstateApp/resources/js/components/Properties/index.vue. Does the file exist?

CamKem's avatar
CamKem
Best Answer
Level 10

Does the file exist? what it is telling you is the file you have reference is not being found.

  • Make sure your file path is correct & the name is exactly as you have it.
  • close your vite server & reboot it, then try to open the page in the browser again.
  • try using the full relative path to the file (/src/js/composables/locations.js - or whatever your path is)
Ngozistephen's avatar

The composable folder was outside the js folder, i had to put it inside my js folder

Please or to participate in this conversation.