Skip to content
This repository has been archived by the owner on Feb 10, 2025. It is now read-only.

Netlify adapter throws error with output: "server" #59

Closed
1 task
teddybee opened this issue Nov 10, 2023 · 5 comments
Closed
1 task

Netlify adapter throws error with output: "server" #59

teddybee opened this issue Nov 10, 2023 · 5 comments
Labels
- P4: important Violate documented behavior or significantly improves performance (priority) pkg: netlify

Comments

@teddybee
Copy link

Astro Info

Astro                    v3.5.2
Node                     v20.9.0
System                   Windows (x64)
Package Manager          npm
Output                   server
Adapter                  @astrojs/netlify
Integrations             @astrojs/tailwind

Describe the Bug

It throws an error if the output: "server" set in the astro.config.
"static" and "hybrid" mode works well.

Nov 10, 11:54:05 PM: 2023-11-10T22:54:05.604Z	undefined	ERROR	Uncaught Exception 	{"errorType":"Error","errorMessage":"Cannot find package '@astrojs/netlify' imported from /var/task/.netlify/functions-internal/entry.mjs","code":"ERR_MODULE_NOT_FOUND","stack":["Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@astrojs/netlify' imported from /var/task/.netlify/functions-internal/entry.mjs","    at new NodeError (node:internal/errors:405:5)","    at packageResolve (node:internal/modules/esm/resolve:895:9)","    at moduleResolve (node:internal/modules/esm/resolve:988:20)","    at moduleResolveWithNodePath (node:internal/modules/esm/resolve:939:12)","    at defaultResolve (node:internal/modules/esm/resolve:1181:79)","    at nextResolve (node:internal/modules/esm/loader:163:28)","    at ESMLoader.resolve (node:internal/modules/esm/loader:835:30)","    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:18)","    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:77:40)","    at link (node:internal/modules/esm/module_job:76:36)"]}Nov 10, 11:54:05 PM: INIT_REPORT Init Duration: 212.75 ms	Phase: invoke	Status: error	Error Type: Runtime.ExitError

What's the expected result?

Start working on netlify.

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-o3ve7p?file=astro.config.mjs

Participation

  • I am willing to submit a pull request for this issue.
@alexanderniebuhr alexanderniebuhr added pkg: netlify needs repro Issue needs a reproduction labels Nov 11, 2023
@alexanderniebuhr
Copy link
Member

Thank you for your report. Can you clarify when you see the error?. Looking at the example, it seems to work fine with npm run dev & npm run build

@teddybee
Copy link
Author

teddybee commented Nov 11, 2023

@alexanderniebuhr When I built and deployed the app (by CLI) to netlify and trying the url in the browser.

@alexanderniebuhr alexanderniebuhr removed the needs repro Issue needs a reproduction label Nov 12, 2023
@lilnasy
Copy link
Contributor

lilnasy commented Nov 14, 2023

Just tried it and it I can confirm the issue.
Preview

@lilnasy lilnasy added the - P4: important Violate documented behavior or significantly improves performance (priority) label Nov 14, 2023
@lilnasy
Copy link
Contributor

lilnasy commented Nov 14, 2023

Affects windows only. Seems to be an issue for netlify-cli, since it is it's responsibility to include node_modules folder.

Reproduction steps:

mkdir x && cd x
pnpm create astro --template basics --yes .
pnpm astro add netlify --yes
pnpm add -D netlify-cli
pnpm astro build
pnpm netlify login
pnpm netlify deploy --dir dist

Preview link when followed on Windows
Preview link when followed on Linux

@lilnasy lilnasy closed this as not planned Won't fix, can't repro, duplicate, stale Nov 14, 2023
@codemonkeynorth
Copy link

can confirm this is a pnpm issue .

it works fine with npm install => netlify build => netlify deploy

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
- P4: important Violate documented behavior or significantly improves performance (priority) pkg: netlify
Projects
None yet
Development

No branches or pull requests

4 participants