nystudio107 / craft-vite

Allows the use of the Vite.js next generation frontend tooling with Craft CMS
MIT License
51 stars 15 forks source link

permissions issue #1

Closed kylerits closed 3 years ago

kylerits commented 3 years ago

Question

I'm not sure if this is more appropriate to address here or on the Vite repo, but I am having an issue with permissions when running the build script. I am not able to build out any folders during build be it 'dist' or any other that I've tested. I am getting an EACCES: permission denied, mkdir '/web' error. Have you run into this before? Is the issue more with Vite or Rollup or my environment?

Additional context

Add any other context or screenshots about the support request here.

I am running the site locally using Laravel valet. I have created a new branch of my starter template that had previously functioned using Webpack and Mix. Running through your blog post I ran into the previously mentioned road block.

Full error:


yarn build                                                                                                                                                                                                           
yarn run v1.22.5
$ vite build
vite v2.2.4 building for production...
transforming (1) vite/dynamic-import-polyfill
warn - You have enabled the JIT engine which is currently in preview.
warn - Preview features are not covered by semver, may introduce breaking changes, and can change at any time.
✓ 3 modules transformed.
EACCES: permission denied, mkdir '/web'
error during build:
Error: EACCES: permission denied, mkdir '/web'
    at Object.mkdirSync (node:fs:1023:3)
    at mkdirpath (/craft3-starter/node_modules/rollup/dist/shared/rollup.js:17987:27)
    at mkdirpath (/craft3-starter/node_modules/rollup/dist/shared/rollup.js:17985:9)
    at mkdirpath (/craft3-starter/node_modules/rollup/dist/shared/rollup.js:17985:9)
    at /craft3-starter/node_modules/rollup/dist/shared/rollup.js:17998:9
    at new Promise (<anonymous>)
    at writeFile (/craft3-starter/node_modules/rollup/dist/shared/rollup.js:17997:12)
    at writeOutputFile (/craft3-starter/node_modules/rollup/dist/shared/rollup.js:20449:25)
    at /craft3-starter/node_modules/rollup/dist/shared/rollup.js:20371:65
    at Array.map (<anonymous>)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
khalwat commented 3 years ago

So this isn't really an issue with the Vite plugin, this is going to be a permissions issue with whatever your local dev environment is imo.

Post your config please?

And also information about your local dev environment.

Tim-Wils commented 3 years ago

This problem is easy to solve prefixeing the path with a . like so: './web' or './public_html'

khalwat commented 3 years ago

Ah, I must have missed that then cleaning up the paths, thanks @Tim-Wils -- I updated the article.

@kylerits change it to:

    outDir: './web/dist/',

(or whatever the relative path to your public web dir is) in your vite.config.js file

kylerits commented 3 years ago

Beautiful. That did it. Thank you.