• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Issue Cannot access vite config file

kylexu22

New Pleskian
Server operating system version
Unknown
Plesk version and microupdate number
Unknown
Hi, this is my first time using web hosting and I am having problems with running my Vite reactjs app. I have Nodejs installed, and I am trying to execute `npm run build` and I am getting an error. The error is centered around the vite config file. I have set all permissions to the correct options but I am still having trouble. Any help would be appreciated, thanks.

Code:
# npm run build
Process exited with non-zero exit code '1'

> [email protected] build
> vite build --config vite.config.js


X [ERROR] Cannot read directory "../../../..": Access is denied.

X [ERROR] Could not resolve "C:\\Inetpub\\vhosts\\tatronrobotics.com\\httpdocs\\vite.config.js"

failed to load config from C:\Inetpub\vhosts\tatronrobotics.com\httpdocs\vite.config.js
error during build:
Error: Build failed with 2 errors:
error: Cannot read directory "../../../..": Access is denied.
error: Could not resolve "C:\\Inetpub\\vhosts\\tatronrobotics.com\\httpdocs\\vite.config.js"
    at failureErrorWithLog (C:\inetpub\vhosts\tatronrobotics.com\httpdocs\node_modules\esbuild\lib\main.js:1651:15)
    at C:\inetpub\vhosts\tatronrobotics.com\httpdocs\node_modules\esbuild\lib\main.js:1059:25
    at runOnEndCallbacks (C:\inetpub\vhosts\tatronrobotics.com\httpdocs\node_modules\esbuild\lib\main.js:1486:45)
    at buildResponseToResult (C:\inetpub\vhosts\tatronrobotics.com\httpdocs\node_modules\esbuild\lib\main.js:1057:7)
    at C:\inetpub\vhosts\tatronrobotics.com\httpdocs\node_modules\esbuild\lib\main.js:1086:16
    at responseCallbacks.<computed> (C:\inetpub\vhosts\tatronrobotics.com\httpdocs\node_modules\esbuild\lib\main.js:704:9)
    at handleIncomingPacket (C:\inetpub\vhosts\tatronrobotics.com\httpdocs\node_modules\esbuild\lib\main.js:764:9)
    at Socket.readFromStdout (C:\inetpub\vhosts\tatronrobotics.com\httpdocs\node_modules\esbuild\lib\main.js:680:7)
    at Socket.emit (node:events:517:28)
    at addChunk (node:internal/streams/readable:335:12)

Here is my vite config file:

Code:
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [react()],
})

Here is the structure of my files:

Screen Shot 2024-04-24 at 7.07.33 AM.png
 
Hi thanks for your response. I've checked all the permissions on the files and they seem to be correct. I was thinking, does this have to do with me not having enough permissions? I am managing the website on an added user account made by the owner of the main subscription. I deployed this website on firebase and there was no problems. So maybe this is a user permission issue?
 
You don't need more, you just need to fix the permission which involved remoting into the server itself to fix it if you cannot do it through the portal. I am not familiar with how node does things but if it's not running as the user of the site then you'll need to update your permissions accordingly for whatever service you're using for node to give it access to your site's directory.

The easiest fix is to to just assign the Everyone permission access to it but doing so is a security risk.

Again, each environment is different, so you'll need to make sure your service account used for node has the permission to the site's directory.
 
Back
Top