Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pnpm i fails #68

Closed
abhi-dasgupta opened this issue Jan 14, 2024 · 13 comments · Fixed by #97 or #99
Closed

pnpm i fails #68

abhi-dasgupta opened this issue Jan 14, 2024 · 13 comments · Fixed by #97 or #99
Assignees
Labels
bug Something isn't working

Comments

@abhi-dasgupta
Copy link

abhi-dasgupta commented Jan 14, 2024

Screenshot 2024-01-14 134758

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

@omgitsjan
Copy link
Contributor

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
Copy link

I am experiencing the same challenge

@sangrepura
Copy link

sangrepura commented Apr 1, 2024

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/[email protected][email protected]/node_modules/vue-demi: Running postinstall script, done in 142ms
node_modules/.pnpm/[email protected]/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\@[email protected]\node_modules\@directus\sdk\dist\index.cjs:1:5976)
  at async Object.request (node_modules\.pnpm\@[email protected]\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/@[email protected]/node_modules/@nuxt/kit/dist/index.mjs:2112:18)
  at async installModule (/D:/Code/Directus/agency-os/node_modules/.pnpm/@[email protected]/node_modules/@nuxt/kit/dist/index.mjs:2415:95)
  at async initNuxt (/D:/Code/Directus/agency-os/node_modules/.pnpm/[email protected][email protected][email protected][email protected][email protected]/node_modules/nuxt/dist/in
dex.mjs:4023:7)
  at async loadNuxt (/D:/Code/Directus/agency-os/node_modules/.pnpm/[email protected][email protected][email protected][email protected][email protected]/node_modules/nuxt/dist/in
dex.mjs:4121:5)
  at async loadNuxt (/D:/Code/Directus/agency-os/node_modules/.pnpm/@[email protected]/node_modules/@nuxt/kit/dist/index.mjs:2570:19)
  at async Object.run (/D:/Code/Directus/agency-os/node_modules/.pnpm/[email protected]/node_modules/nuxi/dist/chunks/prepare.mjs:53:18)
  at async runCommand$1 (/D:/Code/Directus/agency-os/node_modules/.pnpm/[email protected]/node_modules/nuxi/dist/shared/nuxi.a9f3bca7.mjs:1648:16)
  at async runCommand$1 (/D:/Code/Directus/agency-os/node_modules/.pnpm/[email protected]/node_modules/nuxi/dist/shared/nuxi.a9f3bca7.mjs:1639:11)
  at async runMain$1 (/D:/Code/Directus/agency-os/node_modules/.pnpm/[email protected]/node_modules/nuxi/dist/shared/nuxi.a9f3bca7.mjs:1777:7)

 ERROR  fetch failed                                                                                                                                    17:27:11
 ELIFECYCLE  Command failed with exit code 1.
 ```

@bryantgillespie
Copy link
Contributor

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
Copy link

Jason-Young-AI commented Jun 20, 2024

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
Copy link

pepsinio commented Jul 8, 2024

Same as well

@bryantgillespie
Copy link
Contributor

bryantgillespie commented Jul 8, 2024

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
Copy link

pepsinio commented Jul 8, 2024

@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
Copy link
Contributor

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

@pepsinio
Copy link

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

@ComfortablyCoding
Copy link
Contributor

ComfortablyCoding commented Jul 18, 2024

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
Copy link

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
Copy link
Contributor

ComfortablyCoding commented Jul 23, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
8 participants