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

Vanilla Project Doesn't Run At All - Parse failure: Unexpected token At file: /node_modules/@astrojs/image/dist/lib/get-image.js #8

Open
stephan0x opened this issue Jul 29, 2023 · 3 comments

Comments

@stephan0x
Copy link

Hi,

Have cloned the entire project.
Run the commands:
npm install

npm run dev

Visiting http://localhost:3000/

I receive the following error message on the webpage:

Error An error occurred. Parse failure: Unexpected token (81:70) At file: /node_modules/@astrojs/image/dist/lib/get-image.js Contents of line 81: const isDev = (_b = (Object.assign(import.meta.env,{_:process.env._,-:process.env.-,SSR:true,}))) == null ? void 0 : _b.DEV;

And the following error message on terminal
`
Parse failure: Unexpected token (81:70)
At file: /node_modules/@astrojs/image/dist/lib/get-image.js
Contents of line 81: const isDev = (b = (Object.assign(import.meta.env,{:process.env._,-:process.env.-,SSR:true,}))) == null ? void 0 : b.DEV;
Parse failure: Unexpected token (81:70)
At file: /node_modules/@astrojs/image/dist/lib/get-image.js
Contents of line 81: const isDev = (b = (Object.assign(import.meta.env,{:process.env.
,-:process.env.-,SSR:true,}))) == null ? void 0 : b.DEV; (x2)
7:13:10 pm [vite] Error when evaluating SSR module /node_modules/@astrojs/image/dist/index.js: failed to import "/node_modules/@astrojs/image/dist/lib/get-image.js"
|- Error: Parse failure: Unexpected token (81:70)
At file: /node_modules/@astrojs/image/dist/lib/get-image.js
Contents of line 81: const isDev = (b = (Object.assign(import.meta.env,{:process.env.
,-:process.env.-,SSR:true,}))) == null ? void 0 : _b.DEV;
at ssrTransformScript (file:///Users/tehnoob/Documents/Work/HiTehnoob/astro-2/node_modules/vite/dist/node/chunks/dep-e8f070e8.js:53776:15)
at ssrTransform (file:///Users/tehnoob/Documents/Work/HiTehnoob/astro-2/node_modules/vite/dist/node/chunks/dep-e8f070e8.js:53751:12)
at Object.ssrTransform (file:///Users/tehnoob/Documents/Work/HiTehnoob/astro-2/node_modules/vite/dist/node/chunks/dep-e8f070e8.js:63307:20)
at loadAndTransform (file:///Users/tehnoob/Documents/Work/HiTehnoob/astro-2/node_modules/vite/dist/node/chunks/dep-e8f070e8.js:53422:24)

7:13:10 pm [vite] Error when evaluating SSR module /node_modules/@astrojs/image/components/Image.astro: failed to import "/node_modules/@astrojs/image/dist/index.js"
|- Error: Parse failure: Unexpected token (81:70)
At file: /node_modules/@astrojs/image/dist/lib/get-image.js
Contents of line 81: const isDev = (b = (Object.assign(import.meta.env,{:process.env._,-:process.env.-,SSR:true,}))) == null ? void 0 : _b.DEV;
at ssrTransformScript (file:///Users/tehnoob/Documents/Work/HiTehnoob/astro-2/node_modules/vite/dist/node/chunks/dep-e8f070e8.js:53776:15)
at ssrTransform (file:///Users/tehnoob/Documents/Work/HiTehnoob/astro-2/node_modules/vite/dist/node/chunks/dep-e8f070e8.js:53751:12)
at Object.ssrTransform (file:///Users/tehnoob/Documents/Work/HiTehnoob/astro-2/node_modules/vite/dist/node/chunks/dep-e8f070e8.js:63307:20)
at loadAndTransform (file:///Users/tehnoob/Documents/Work/HiTehnoob/astro-2/node_modules/vite/dist/node/chunks/dep-e8f070e8.js:53422:24)

7:13:10 pm [vite] Error when evaluating SSR module /node_modules/@astrojs/image/components/index.ts: failed to import "/node_modules/@astrojs/image/components/Image.astro"
|- Error: Parse failure: Unexpected token (81:70)
At file: /node_modules/@astrojs/image/dist/lib/get-image.js
Contents of line 81: const isDev = (b = (Object.assign(import.meta.env,{:process.env._,-:process.env.-,SSR:true,}))) == null ? void 0 : _b.DEV;
at ssrTransformScript (file:///Users/tehnoob/Documents/Work/HiTehnoob/astro-2/node_modules/vite/dist/node/chunks/dep-e8f070e8.js:53776:15)
at ssrTransform (file:///Users/tehnoob/Documents/Work/HiTehnoob/astro-2/node_modules/vite/dist/node/chunks/dep-e8f070e8.js:53751:12)
at Object.ssrTransform (file:///Users/tehnoob/Documents/Work/HiTehnoob/astro-2/node_modules/vite/dist/node/chunks/dep-e8f070e8.js:63307:20)
at loadAndTransform (file:///Users/tehnoob/Documents/Work/HiTehnoob/astro-2/node_modules/vite/dist/node/chunks/dep-e8f070e8.js:53422:24)

7:13:10 pm [vite] Error when evaluating SSR module /src/components/hero-image.astro: failed to import "/node_modules/@astrojs/image/components/index.ts"
|- Error: Parse failure: Unexpected token (81:70)
At file: /node_modules/@astrojs/image/dist/lib/get-image.js
Contents of line 81: const isDev = (b = (Object.assign(import.meta.env,{:process.env._,-:process.env.-,SSR:true,}))) == null ? void 0 : _b.DEV;
at ssrTransformScript (file:///Users/tehnoob/Documents/Work/HiTehnoob/astro-2/node_modules/vite/dist/node/chunks/dep-e8f070e8.js:53776:15)
at ssrTransform (file:///Users/tehnoob/Documents/Work/HiTehnoob/astro-2/node_modules/vite/dist/node/chunks/dep-e8f070e8.js:53751:12)
at Object.ssrTransform (file:///Users/tehnoob/Documents/Work/HiTehnoob/astro-2/node_modules/vite/dist/node/chunks/dep-e8f070e8.js:63307:20)
at loadAndTransform (file:///Users/tehnoob/Documents/Work/HiTehnoob/astro-2/node_modules/vite/dist/node/chunks/dep-e8f070e8.js:53422:24)

7:13:10 pm [vite] Error when evaluating SSR module /src/components/footer.astro: failed to import "/src/components/hero-image.astro"
|- Error: Parse failure: Unexpected token (81:70)
At file: /node_modules/@astrojs/image/dist/lib/get-image.js
Contents of line 81: const isDev = (b = (Object.assign(import.meta.env,{:process.env._,-:process.env.-,SSR:true,}))) == null ? void 0 : _b.DEV;
at ssrTransformScript (file:///Users/tehnoob/Documents/Work/HiTehnoob/astro-2/node_modules/vite/dist/node/chunks/dep-e8f070e8.js:53776:15)
at ssrTransform (file:///Users/tehnoob/Documents/Work/HiTehnoob/astro-2/node_modules/vite/dist/node/chunks/dep-e8f070e8.js:53751:12)
at Object.ssrTransform (file:///Users/tehnoob/Documents/Work/HiTehnoob/astro-2/node_modules/vite/dist/node/chunks/dep-e8f070e8.js:63307:20)
at loadAndTransform (file:///Users/tehnoob/Documents/Work/HiTehnoob/astro-2/node_modules/vite/dist/node/chunks/dep-e8f070e8.js:53422:24)

7:13:10 pm [vite] Error when evaluating SSR module /Users/tehnoob/Documents/Work/HiTehnoob/astro-2/src/pages/index.astro: failed to import "/src/components/footer.astro"
|- Error: Parse failure: Unexpected token (81:70)
At file: /node_modules/@astrojs/image/dist/lib/get-image.js
Contents of line 81: const isDev = (b = (Object.assign(import.meta.env,{:process.env._,-:process.env.-,SSR:true,}))) == null ? void 0 : _b.DEV;
at ssrTransformScript (file:///Users/tehnoob/Documents/Work/HiTehnoob/astro-2/node_modules/vite/dist/node/chunks/dep-e8f070e8.js:53776:15)
at ssrTransform (file:///Users/tehnoob/Documents/Work/HiTehnoob/astro-2/node_modules/vite/dist/node/chunks/dep-e8f070e8.js:53751:12)
at Object.ssrTransform (file:///Users/tehnoob/Documents/Work/HiTehnoob/astro-2/node_modules/vite/dist/node/chunks/dep-e8f070e8.js:63307:20)
at loadAndTransform (file:///Users/tehnoob/Documents/Work/HiTehnoob/astro-2/node_modules/vite/dist/node/chunks/dep-e8f070e8.js:53422:24)

error Parse failure: Unexpected token (81:70)
At file: /node_modules/@astrojs/image/dist/lib/get-image.js
Contents of line 81: const isDev = (b = (Object.assign(import.meta.env,{:process.env._,-:process.env.-,SSR:true,}))) == null ? void 0 : b.DEV;
Error: Parse failure: Unexpected token (81:70)
At file: /node_modules/@astrojs/image/dist/lib/get-image.js
Contents of line 81: const isDev = (b = (Object.assign(import.meta.env,{:process.env.
,-:process.env.-,SSR:true,}))) == null ? void 0 : _b.DEV;
at ssrTransformScript (file:///Users/tehnoob/Documents/Work/HiTehnoob/astro-2/node_modules/vite/dist/node/chunks/dep-e8f070e8.js:53776:15)
at ssrTransform (file:///Users/tehnoob/Documents/Work/HiTehnoob/astro-2/node_modules/vite/dist/node/chunks/dep-e8f070e8.js:53751:12)
at Object.ssrTransform (file:///Users/tehnoob/Documents/Work/HiTehnoob/astro-2/node_modules/vite/dist/node/chunks/dep-e8f070e8.js:63307:20)
at loadAndTransform (file:///Users/tehnoob/Documents/Work/HiTehnoob/astro-2/node_modules/vite/dist/node/chunks/dep-e8f070e8.js:53422:24)`

Was really excited to work with this but I can't even get the project to load on vanilla.

@mhyfritz
Copy link
Owner

mhyfritz commented Aug 2, 2023

Hi,

first time I see this error. I did a fresh clone on my machine and cannot reproduce this.

Did npm install complete without errors? You can run npm run clean and then npm install again, just to make sure. Also, you could try switching/updating your node version.

If the error persists, probably best to open an issue on the Astro repo, as the error occurs in the Astro image integration.

Sorry, not much more I can do I'm afraid!

@natemoo-re
Copy link

@mhyfritz would it be possible to upgrade this template to use the astro:assets feature? It is replacing the @astrojs/image integration, so it'd be great to get everyone started off on the right foot. Here's the upgrade guide.

@mhyfritz
Copy link
Owner

Just upgraded to Astro 3 and astro:assets.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants