Closed davycoe closed 1 year ago
Looks like you are not using npm but Yarn:
The Yarn Plug'n'Play manifest forbids importing "mime" here because it's not listed as a
dependency of this package:
Just tested locally with your instructions and it works.
Looks like you are not using npm but Yarn:
The Yarn Plug'n'Play manifest forbids importing "mime" here because it's not listed as a dependency of this package:
Just tested locally with your instructions and it works.
Yeah that is what it looks like but I don't even have yarn
installed.
I can install "astrojs/cloudflare": "4.1.0"
and it will build no problem
When I install "astrojs/cloudflare": "4.1.1"
it can't build and spits out the messages about yarn.
I did try to reproduce on stackblitz and 4.1.1 worked no problem so it seems it's just my local machine
"astrojs/cloudflare": "4.1.0"
works using yarn too.output:
[coe@arch omg-yarn]$ yarn build
yarn run v1.22.19
$ astro build
15:38:44 [build] output target: server
15:38:44 [build] deploy adapter: @astrojs/cloudflare
15:38:44 [build] Collecting build info...
15:38:44 [build] Completed in 13ms.
15:38:44 [build] Building server entrypoints...
15:38:46 [build] Completed in 1.98s.
finalizing server assets
15:38:46 [build] Rearranging server assets...
✘ [ERROR] Could not resolve "mime"
dist/$server_build/_worker.js:1:17:
1 │ import mime from 'mime';
╵ ~~~~~~
The Yarn Plug'n'Play manifest forbids importing "mime" here because it's not listed as a
dependency of this package:
../../.pnp.cjs:43:33:
43 │ "packageDependencies": [\
╵ ~~
You can mark the path "mime" as external to exclude it from the bundle, which will
remove this error.
✘ [ERROR] Could not resolve "cookie"
dist/$server_build/_worker.js:2:33:
2 │ import { serialize, parse } from 'cookie';
╵ ~~~~~~~~
The Yarn Plug'n'Play manifest forbids importing "cookie" here because it's not listed as
a dependency of this package:
../../.pnp.cjs:43:33:
43 │ "packageDependencies": [\
╵ ~~
You can mark the path "cookie" as external to exclude it from the bundle, which will
remove this error.
✘ [ERROR] Could not resolve "html-escaper"
dist/$server_build/_worker.js:3:23:
3 │ import { escape } from 'html-escaper';
╵ ~~~~~~~~~~~~~~
The Yarn Plug'n'Play manifest forbids importing "html-escaper" here because it's not
listed as a dependency of this package:
../../.pnp.cjs:43:33:
43 │ "packageDependencies": [\
╵ ~~
You can mark the path "html-escaper" as external to exclude it from the bundle, which
will remove this error.
✘ [ERROR] Could not resolve "kleur/colors"
dist/$server_build/_worker.js:4:52:
4 │ import { bold, yellow, dim, cyan, red, reset } from 'kleur/colors';
╵ ~~~~~~~~~~~~~~
The Yarn Plug'n'Play manifest forbids importing "kleur" here because it's not listed as
a dependency of this package:
../../.pnp.cjs:43:33:
43 │ "packageDependencies": [\
╵ ~~
You can mark the path "kleur/colors" as external to exclude it from the bundle, which
will remove this error.
✘ [ERROR] Could not resolve "string-width"
dist/$server_build/_worker.js:5:7:
5 │ import 'string-width';
╵ ~~~~~~~~~~~~~~
The Yarn Plug'n'Play manifest forbids importing "string-width" here because it's not
listed as a dependency of this package:
../../.pnp.cjs:43:33:
43 │ "packageDependencies": [\
╵ ~~
You can mark the path "string-width" as external to exclude it from the bundle, which
will remove this error.
✘ [ERROR] Could not resolve "path-browserify"
dist/$server_build/_worker.js:6:18:
6 │ import npath from 'path-browserify';
╵ ~~~~~~~~~~~~~~~~~
The Yarn Plug'n'Play manifest forbids importing "path-browserify" here because it's not
listed as a dependency of this package:
../../.pnp.cjs:43:33:
43 │ "packageDependencies": [\
╵ ~~
You can mark the path "path-browserify" as external to exclude it from the bundle, which
will remove this error.
✘ [ERROR] Could not resolve "path-to-regexp"
dist/$server_build/_worker.js:7:71:
7 │ ...s */import { compile } from 'path-to-regexp';
╵ ~~~~~~~~~~~~~~~~
The Yarn Plug'n'Play manifest forbids importing "path-to-regexp" here because it's not
listed as a dependency of this package:
../../.pnp.cjs:43:33:
43 │ "packageDependencies": [\
╵ ~~
You can mark the path "path-to-regexp" as external to exclude it from the bundle, which
will remove this error.
error Could not resolve "mime"
File:
dist/$server_build/_worker.js:1:17
Code:
> 1 | import mime from 'mime';
| ^
2 | import { serialize, parse } from 'cookie';
3 | import { escape } from 'html-escaper';
4 | import { bold, yellow, dim, cyan, red, reset } from 'kleur/colors';
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Tested this on a couple different linux distro's and they worked fine.
This seems to be an issue I need to resolve on my system!
the offending file was related to an old yarn install, in my local user profile: ~/.pnp.cjs
after removing that fixed the issue.
the offending file was related to an old yarn install, in my local user profile:
~/.pnp.cjs
after removing that fixed the issue.
Thank you, very help full and this fixed my issue as well.
What version of
astro
are you using?1.6.14
Are you using an SSR adapter? If so, which one?
@astrojs/cloudflare": "^4.1.1"
What package manager are you using?
npm
What operating system are you using?
Linux
Describe the Bug
Updating to: "@astrojs/cloudflare": "^4.1.1" breaks build locally.
node
v16.18.0
fresh install
npm create astro@latest
npx astro add cloudflare
npm run build
Builds successfully on cloudflare
I can build locally if I revert back to "@astrojs/cloudflare": "^4.1.0"
Full output:
Link to Minimal Reproducible Example
https://github.com/davycoe/cloudflare-adapter-bug
Participation