directus-labs / agency-os

The open source operating system for digital agencies. Built with Directus and Nuxt.
https://agencyos.dev
MIT License
605 stars 118 forks source link

pnpm i fails #68

Closed abhi-dasgupta closed 4 months ago

abhi-dasgupta commented 10 months ago

Screenshot 2024-01-14 134758

Directus is hosted on DigitalOcean through Cloudron...everything works fine on that end

omgitsjan commented 10 months ago

Hey there! I need a bit more info to get a clearer picture of what's going on. Could you tell me which pnpm version you're using? Also, it would be super helpful if you could walk me through what you did step by step, or even better, if you could recreate the issue for me. And don't forget to mention whether you're on Windows, Linux, or something else.

I'm thinking there might be a problem with your API key permissions (as it stands, there is a problem with permission on the Directus end). Have you double-checked that the user in Directus has all the right privileges? And make sure you hit 'save' after setting up your API key, it's an easy thing to miss.

Also, double-check the roles here: image

mrdankuta commented 10 months ago

I am experiencing the same challenge

sangrepura commented 8 months ago

Same here. There's a lot of things broken in this repo. Also my API token is saved and correct.


pnpm i
Lockfile is up to date, resolution step is skipped
Packages: +1274
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Packages are copied from the content-addressable store to the virtual store.
  Content-addressable store is at: D:\.pnpm-store\v3
  Virtual store is at:             node_modules/.pnpm
Downloading registry.npmjs.org/@iconify/json/2.2.166: 68.4 MB/68.4 MB, done
Progress: resolved 1274, reused 905, downloaded 368, added 1274, done
node_modules/.pnpm/vue-demi@0.14.7_vue@3.4.21/node_modules/vue-demi: Running postinstall script, done in 142ms
node_modules/.pnpm/sharp@0.32.6/node_modules/sharp: Running install script, done in 1s

dependencies:
+ @nuxt/image 1.1.0
+ nuxt-og-image 3.0.0-rc.23

devDependencies:
+ @directus/sdk 14.0.0
+ @directus/types 11.0.3
+ @formkit/auto-animate 1.0.0-beta.6
+ @headlessui/vue 1.7.16
+ @iconify/json 2.2.166
+ @nuxt/devtools 1.0.8
+ @nuxt/ui 2.11.1
+ @nuxtjs/color-mode 3.3.2
+ @nuxtjs/eslint-config-typescript 12.1.0
+ @nuxtjs/eslint-module 4.1.0
+ @nuxtjs/google-fonts 3.1.3
+ @nuxtjs/tailwindcss 6.10.3
+ @stripe/stripe-js 2.2.2
+ @tailwindcss/forms 0.5.7
+ @tailwindcss/typography 0.5.10
+ @types/uuid 9.0.7
+ @vueuse/core 10.7.1
+ @vueuse/motion 2.0.0
+ @vueuse/nuxt 10.7.1
+ eslint 8.56.0
+ eslint-config-prettier 9.1.0
+ eslint-plugin-prettier 5.1.2
+ eslint-plugin-vue 9.19.2
+ floating-vue 2.0.0-beta.24
+ form-data 4.0.0
+ jwt-decode 3.1.2
+ micromark 4.0.0
+ micromark-extension-gfm 3.0.0
+ nuxt 3.10.3
+ nuxt-icon 0.6.8
+ nuxt-schema-org 3.3.2
+ nuxt-simple-sitemap 3.4.0
+ prettier 3.1.1
+ stripe 13.8.0
+ typescript 5.3.3
+ uuid 9.0.1
+ v-perfect-signature 1.4.0
+ vue-tsc 1.8.27

> @ postinstall D:\Code\Directus\agency-os
> nuxt prepare

◐ Loading Directus Module                                                                                                                               17:27:11

 ERROR  fetch failed                                                                                                                                    17:27:11

  at node:internal/deps/undici/undici:12345:11
  at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
  at async R (node_modules\.pnpm\@directus+sdk@14.0.0\node_modules\@directus\sdk\dist\index.cjs:1:5976)
  at async Object.request (node_modules\.pnpm\@directus+sdk@14.0.0\node_modules\@directus\sdk\dist\index.cjs:1:34790)
  at async setup (D:/Code/Directus/agency-os/modules/directus/index.ts:163:23)
  at async normalizedModule (D:/Code/Directus/agency-os/node_modules/.pnpm/@nuxt+kit@3.10.3/node_modules/@nuxt/kit/dist/index.mjs:2112:18)
  at async installModule (/D:/Code/Directus/agency-os/node_modules/.pnpm/@nuxt+kit@3.10.3/node_modules/@nuxt/kit/dist/index.mjs:2415:95)
  at async initNuxt (/D:/Code/Directus/agency-os/node_modules/.pnpm/nuxt@3.10.3_eslint@8.56.0_typescript@5.3.3_vite@5.1.4_vue-tsc@1.8.27/node_modules/nuxt/dist/in
dex.mjs:4023:7)
  at async loadNuxt (/D:/Code/Directus/agency-os/node_modules/.pnpm/nuxt@3.10.3_eslint@8.56.0_typescript@5.3.3_vite@5.1.4_vue-tsc@1.8.27/node_modules/nuxt/dist/in
dex.mjs:4121:5)
  at async loadNuxt (/D:/Code/Directus/agency-os/node_modules/.pnpm/@nuxt+kit@3.10.3/node_modules/@nuxt/kit/dist/index.mjs:2570:19)
  at async Object.run (/D:/Code/Directus/agency-os/node_modules/.pnpm/nuxi@3.10.1/node_modules/nuxi/dist/chunks/prepare.mjs:53:18)
  at async runCommand$1 (/D:/Code/Directus/agency-os/node_modules/.pnpm/nuxi@3.10.1/node_modules/nuxi/dist/shared/nuxi.a9f3bca7.mjs:1648:16)
  at async runCommand$1 (/D:/Code/Directus/agency-os/node_modules/.pnpm/nuxi@3.10.1/node_modules/nuxi/dist/shared/nuxi.a9f3bca7.mjs:1639:11)
  at async runMain$1 (/D:/Code/Directus/agency-os/node_modules/.pnpm/nuxi@3.10.1/node_modules/nuxi/dist/shared/nuxi.a9f3bca7.mjs:1777:7)

 ERROR  fetch failed                                                                                                                                    17:27:11
 ELIFECYCLE  Command failed with exit code 1.
 ```
bryantgillespie commented 8 months ago

The error you're seeing is not an pnpm issue.

After running pnpm i - Nuxt runs a post install script to generate a .nuxt directory and generate types. As part of that it loads modules as well. https://nuxt.com/docs/api/commands/prepare

The error you're seeing is coming from the Directus module included in template. The module tries to fetch redirects from the Directus instance. And it doesn't appear to be able to reach the Directus instance.

Jason-Young-AI commented 5 months ago

I have the same issue. I used Postman to check if the RestAPI of my Directus instance and the admin's Bearer token were working correctly. I found everything normal, but pnpm i still have the same problem as @abhi-dasgupta.

pepsinio commented 4 months ago

Same as well

bryantgillespie commented 4 months ago

Did you add your DIRECTUS_URL to the .env file?

If so, and you are sure the .ENV file is correct - I'd look at the CORS settings for your Directus config.

pepsinio commented 4 months ago

@bryantgillespie where can i find those settings more precisely? NOTE: i tried adding it it to the compose file as env variable but did not help. I am running Directus on different machine from the UI

bryantgillespie commented 4 months ago

Here's the specific link to the CORS config. https://docs.directus.io/self-hosted/config-options.html#cors

pepsinio commented 4 months ago

Thanks @bryantgillespie I tried it, but unfortunately still does not work :(

ComfortablyCoding commented 4 months ago

As long as DIRECTUS_URL is set and your Directus instance is reachable this issue should not be present. The build will now complete even if this data cannot be fetched.

Due to this leaving it closed as resolved for now, happy to re-open if this is still an issue after the above 2 things have been verified to not be the cause.

pepsinio commented 4 months ago

thanks @ComfortablyCoding. This fix seems to help. however now getting other errors:

[Vue warn]: Property "title" was accessed during render but is not defined on instance.

Tried removing globals: { title }, from TheHeader.vue and return appConfig.globals.logo_on_dark_bg; from Logo.vue (due to other error), but still does not work, throwing errors that page is missing.

Not sure whether anyone has tried and succeeded running this template in it's current state.

ComfortablyCoding commented 4 months ago

thanks @ComfortablyCoding. This fix seems to help. however now getting other errors:

Glad to hear it helped! The merged PR was primarily to mitigate a crash/error on install, the underlying issue is generally due to a misconfiguration. Happy to look into this further if this is not the case for you.

[Vue warn]: Property "title" was accessed during render but is not defined on instance.

Tried removing globals: { title }, from TheHeader.vue and return appConfig.globals.logo_on_dark_bg; from Logo.vue (due to other error), but still does not work, throwing errors that page is missing.

I will look into this case when I have the chance. I would assume some global is required but missing due to the failed request.

I am thinking the ideal path here is to either add default values for globals or revert back to the error state on failure. At the moment leaning toward adding back the error.

Generally the globals and redirect requests fail due to the following:

  1. Incorrect or invalid DIRECTUS_URL
  2. The directus instance is not reachable
  3. The permissions for globals and redirects are incorrect. They should allow read for the public role.

If in your case it is not one of these 3 happy to debug further in the directus discord, my handle is the same as here.

EDIT: Optional access was added as a temporary fix in #99

Not sure whether anyone has tried and succeeded running this template in it's current state.

I don't encounter this issue on my side unless one of the issues mentioned above are present.

As this is a community maintained repo PRs are always welcome for any issues/improvements.