Build is failing | Module '"@vercel/fetch"' has no exported member 'Response'. Did you mean to use 'import Response from "@vercel/fetch"' instead?
See original GitHub issueI just pulled the repo to test out the demo and the build is failing:
$ npm run build
nextjs-commerce@1.0.0 build /Users/Temp/commerce next build
next.config.js { “commerce”: { “features”: { “cart”: false, “search”: false, “wishlist”: false, “customerAuth”: false, “customCheckout”: false }, “provider”: “local” }, “i18n”: { “locales”: [ “en-US”, “es” ], “defaultLocale”: “en-US” }, “images”: { “domains”: [ “localhost” ] }, “env”: {} } Failed to compile.
./framework/commerce/api/index.ts:2:29 Type error: Module ‘“@vercel/fetch”’ has no exported member ‘Response’. Did you mean to use ‘import Response from “@vercel/fetch”’ instead?
1 | import type { NextApiHandler } from ‘next’
2 | import type { FetchOptions, Response } from ‘@vercel/fetch’
3 | import type { APIEndpoint, APIHandler } from ‘./utils/types’
4 | import type { CartSchema } from ‘…/types/cart’
5 | import type { CustomerSchema } from ‘…/types/customer’
info - Checking validity of types .npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! nextjs-commerce@1.0.0 build: next build
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the nextjs-commerce@1.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:8 (1 by maintainers)
Local add to cart doesn’t work for me either. Might be something to do with localhost not being allowed for Shopify storefront api? No idea…
Not an expert on typescript, i followed the error suggestion by removing the Reponse import and added this: import Response from ‘@vercel/fetch’
build seems fine now
BTW u also need to update the errors.ts file too (the build error will lead u to it)