在运行npm I next@latest react@latest eslint-config-next@latest命令之前,我从github上提交了一个文件
我可以建立它没有问题。然后,当我运行这个命令并试图构建它时,它给了我SyntaxError: JSON中位置0的意外token u
现在在vercel上它可以工作,在我的macbook pro上它只能在我的windows 10 pro pc上工作,我不能构建甚至在dev中运行。
68405> npm i
npm WARN deprecated @types/mongoose@5.11.97: Mongoose publishes its own types, so you do not need to install this package.
added 221 packages, and audited 222 packages in 3s
30 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
PS C:UsersMRSinghDesktopWebsite> npm run build
> build
> next build
info - Loaded env from C:UsersMRSinghDesktopWebsite.env.local
warn - You have enabled experimental feature (appDir) in next.config.js.
warn - Experimental features are not covered by semver, and may cause unexpected or broken application behavior. Use at your own risk.
info - Thank you for testing `appDir` please leave your feedback at
https://nextjs.link/app-feedback
Warning: For production Image Optimization with Next.js, the optional 'sharp' package is strongly recommended. Run 'yarn add sharp', and Next.js will use it automatically for Image Optimization.
Read more: https://nextjs.org/docs/messages/sharp-missing-in-production
info - Creating an optimized production build
warn - Compiled with warnings
./node_modules/debug/src/node.js
Module not found: Can't resolve 'supports-color' in 'C:UsersMRSinghDesktopWebsitenode_modulesdebugsrc'
Import trace for requested module:
./node_modules/debug/src/node.js
./node_modules/debug/src/index.js
./node_modules/follow-redirects/debug.js
./node_modules/follow-redirects/index.js
./node_modules/axios/lib/adapters/http.js
./node_modules/axios/lib/adapters/adapters.js
./node_modules/axios/lib/core/dispatchRequest.js
./node_modules/axios/lib/core/Axios.js
./node_modules/axios/lib/axios.js
./node_modules/axios/index.js
./app/shop/components/SaleForm.tsx
info - Linting and checking validity of types
info - Collecting page data
info - Generating static pages (14/14)
info - Finalizing page optimization
Route (app) Size First Load JS
┌ ○ / 0 B 0 B
├ ○ /admin 163 B 67.2 kB
├ ○ /region 163 B 67.2 kB
├ ○ /auth 965 B 78.6 kB
├ ○ /shop 19.9 kB 97.6 kB
├ ○ /shop/daily 166 B 67.2 kB
├ ○ /shop/management 166 B 67.2 kB
├ ○ /shop/monthly 166 B 67.2 kB
├ ○ /shop/profile 166 B 67.2 kB
├ ○ /shop/quarterly 166 B 67.2 kB
├ ○ /shop/returns 166 B 67.2 kB
└ ○ /shop/weekly 165 B 67.2 kB
+ First Load JS shared by all 67 kB
├ chunks/17-2d54602f20b449ab.js 64.7 kB
├ chunks/main-app-6cef3c43ceb652fc.js 204 B
└ chunks/webpack-1a28356fdbd282fd.js 2.15 kB
Route (pages) Size First Load JS
┌ ○ /404 179 B 81.8 kB
├ λ /api/auth/[...nextauth] 0 B 81.6 kB
└ λ /api/hello 0 B 81.6 kB
+ First Load JS shared by all 81.6 kB
├ chunks/pages/_app-5841ab2cb3aa228d.js 192 B
└ chunks/webpack-1a28356fdbd282fd.js 2.15 kB
ƒ Middleware 63.3 kB
λ (Server) server-side renders at runtime (uses getInitialProps or
getServerSideProps)
○ (Static) automatically rendered as static HTML (uses no initial props)
PS C:UsersMRSinghDesktopWebsite> npm start
> start
> next start
ready - started server on 0.0.0.0:3000, url: http://localhost:3000
info - Loaded env from C:UsersMRSinghDesktopWebsite.env.local
warn - You have enabled experimental feature (appDir) in next.config.js.
info - Thank you for testing `appDir` please leave your feedback at https://nextjs.link/app-feedback
Terminate batch job (Y/N)? y
UP TO HERE WORKS FINE NOW I UPGRADE
PS C:UsersMRSinghDesktopWebsite> npm i next@latest react@latest react-dom@latest eslint-config-next@latest
added 216 packages, changed 3 packages, and audited 438 packages in 7s
124 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
PS C:UsersMRSinghDesktopWebsite> npm run build
> build
> next build
info - Loaded env from C:UsersMRSinghDesktopWebsite.env.local
warn - You have enabled experimental feature (appDir) in next.config.js.
warn - Experimental features are not covered by semver, and may cause unexpected or broken application behavior. Use at your own risk.
info - Thank you for testing `appDir` please leave your feedback at https://nextjs.link/app-feedback
info - Creating an optimized production build ..<w> [webpack.cache.PackFileCacheStrategy] Serializing big strings (659kiB) impacts deserialization performance (consider using Buffer instead and decode when needed)
info - Creating an optimized production build
info - Compiled successfully
info - Linting and checking validity of types
info - Collecting page data
[ ] info - Generating static pages (0/14)SyntaxError: Unexpected token u in JSON at position 0
at JSON.parse (<anonymous>)
at U (C:UsersMRSinghDesktopWebsitenode_modulesnextdistcompiledreact-server-dom-webpackcjsreact-server-dom-webpack-client.edge.production.min.js:22:53)
at c (C:UsersMRSinghDesktopWebsitenode_modulesnextdistcompiledreact-server-dom-webpackcjsreact-server-dom-webpack-client.edge.production.min.js:24:307)
SyntaxError: Unexpected token u in JSON at position 0
at JSON.parse (<anonymous>)
at U (C:UsersMRSinghDesktopWebsitenode_modulesnextdistcompiledreact-server-dom-webpackcjsreact-server-dom-webpack-client.edge.production.min.js:22:53)
at c (C:UsersMRSinghDesktopWebsitenode_modulesnextdistcompiledreact-server-dom-webpackcjsreact-server-dom-webpack-client.edge.production.min.js:24:307)
SyntaxError: Unexpected token u in JSON at position 0
at JSON.parse (<anonymous>)
at U (C:UsersMRSinghDesktopWebsitenode_modulesnextdistcompiledreact-server-dom-webpackcjsreact-server-dom-webpack-client.edge.production.min.js:22:53)
at c (C:UsersMRSinghDesktopWebsitenode_modulesnextdistcompiledreact-server-dom-webpackcjsreact-server-dom-webpack-client.edge.production.min.js:24:307)
SyntaxError: Unexpected token u in JSON at position 0
at JSON.parse (<anonymous>)
at U (C:UsersMRSinghDesktopWebsitenode_modulesnextdistcompiledreact-server-dom-webpackcjsreact-server-dom-webpack-client.edge.production.min.js:22:53)
at c (C:UsersMRSinghDesktopWebsitenode_modulesnextdistcompiledreact-server-dom-webpackcjsreact-server-dom-webpack-client.edge.production.min.js:24:307)
SyntaxError: Unexpected token u in JSON at position 0
at JSON.parse (<anonymous>)
at U (C:UsersMRSinghDesktopWebsitenode_modulesnextdistcompiledreact-server-dom-webpackcjsreact-server-dom-webpack-client.edge.production.min.js:22:53)
at c (C:UsersMRSinghDesktopWebsitenode_modulesnextdistcompiledreact-server-dom-webpackcjsreact-server-dom-webpack-client.edge.production.min.js:24:307)
SyntaxError: Unexpected token u in JSON at position 0
at JSON.parse (<anonymous>)
at U (C:UsersMRSinghDesktopWebsitenode_modulesnextdistcompiledreact-server-dom-webpackcjsreact-server-dom-webpack-client.edge.production.min.js:22:53)
at c (C:UsersMRSinghDesktopWebsitenode_modulesnextdistcompiledreact-server-dom-webpackcjsreact-server-dom-webpack-client.edge.production.min.js:24:307)
SyntaxError: Unexpected token u in JSON at position 0
at JSON.parse (<anonymous>)
at U (C:UsersMRSinghDesktopWebsitenode_modulesnextdistcompiledreact-server-dom-webpackcjsreact-server-dom-webpack-client.edge.production.min.js:22:53)
at c (C:UsersMRSinghDesktopWebsitenode_modulesnextdistcompiledreact-server-dom-webpackcjsreact-server-dom-webpack-client.edge.production.min.js:24:307)
Error occurred prerendering page "/shop/returns". Read more: https://nextjs.org/docs/messages/prerender-error
SyntaxError: Unexpected token u in JSON at position 0
at JSON.parse (<anonymous>)
at U (C:UsersMRSinghDesktopWebsitenode_modulesnextdistcompiledreact-server-dom-webpackcjsreact-server-dom-webpack-client.edge.production.min.js:22:53)
at c (C:UsersMRSinghDesktopWebsitenode_modulesnextdistcompiledreact-server-dom-webpackcjsreact-server-dom-webpack-client.edge.production.min.js:24:307)
SyntaxError: Unexpected token u in JSON at position 0
at JSON.parse (<anonymous>)
at U (C:UsersMRSinghDesktopWebsitenode_modulesnextdistcompiledreact-server-dom-webpackcjsreact-server-dom-webpack-client.edge.production.min.js:22:53)
at c (C:UsersMRSinghDesktopWebsitenode_modulesnextdistcompiledreact-server-dom-webpackcjsreact-server-dom-webpack-client.edge.production.min.js:24:307)
Error occurred prerendering page "/". Read more: https://nextjs.org/docs/messages/prerender-error
SyntaxError: Unexpected token u in JSON at position 0
at JSON.parse (<anonymous>)
at U (C:UsersMRSinghDesktopWebsitenode_modulesnextdistcompiledreact-server-dom-webpackcjsreact-server-dom-webpack-client.edge.production.min.js:22:53)
at c (C:UsersMRSinghDesktopWebsitenode_modulesnextdistcompiledreact-server-dom-webpackcjsreact-server-dom-webpack-client.edge.production.min.js:24:307)
Error occurred prerendering page "/shop/monthly". Read more: https://nextjs.org/docs/messages/prerender-error
SyntaxError: Unexpected token u in JSON at position 0
at JSON.parse (<anonymous>)
at U (C:UsersMRSinghDesktopWebsitenode_modulesnextdistcompiledreact-server-dom-webpackcjsreact-server-dom-webpack-client.edge.production.min.js:22:53)
at c (C:UsersMRSinghDesktopWebsitenode_modulesnextdistcompiledreact-server-dom-webpackcjsreact-server-dom-webpack-client.edge.production.min.js:24:307)
SyntaxError: Unexpected token u in JSON at position 0
at JSON.parse (<anonymous>)
at U (C:UsersMRSinghDesktopWebsitenode_modulesnextdistcompiledreact-server-dom-webpackcjsreact-server-dom-webpack-client.edge.production.min.js:22:53)
at c (C:UsersMRSinghDesktopWebsitenode_modulesnextdistcompiledreact-server-dom-webpackcjsreact-server-dom-webpack-client.edge.production.min.js:24:307)
Error occurred prerendering page "/region". Read more: https://nextjs.org/docs/messages/prerender-error
SyntaxError: Unexpected token u in JSON at position 0`enter code here`
at JSON.parse (<anonymous>)`enter code here`
at U (C:UsersMRSinghDesktopWebsitenode_modulesnextdistcompiledreact-server-dom-webpackcjsreact-server-dom-webpack-client.edge.production.min.js:22:53)
at c (C:UsersMRSinghDesktopWebsitenode_modulesnextdistcompiledreact-server-dom-webpackcjsreact-server-dom-webpack-client.edge.production.min.js:24:307)
SyntaxError: Unexpected token u in JSON at position 0
at JSON.parse (<anonymous>)
at U (C:UsersMRSinghDesktopWebsitenode_modulesnextdistcompiledreact-server-dom-webpackcjsreact-server-dom-webpack-client.edge.production.min.js:22:53)
at c (C:UsersMRSinghDesktopWebsitenode_modulesnextdistcompiledreact-server-dom-webpackcjsreact-server-dom-webpack-client.edge.production.min.js:24:307)
Error occurred prerendering page "/auth". Read more: https://nextjs.org/docs/messages/prerender-error
SyntaxError: Unexpected token u in JSON at position 0
at JSON.parse (<anonymous>)
at U (C:UsersMRSinghDesktopWebsitenode_modulesnextdistcompiledreact-server-dom-webpackcjsreact-server-dom-webpack-client.edge.production.min.js:22:53)
at c (C:UsersMRSinghDesktopWebsitenode_modulesnextdistcompiledreact-server-dom-webpackcjsreact-server-dom-webpack-client.edge.production.min.js:24:307)
Error occurred prerendering page "/shop/profile". Read more: https://nextjs.org/docs/messages/prerender-error
SyntaxError: Unexpected token u in JSON at position 0
at JSON.parse (<anonymous>)
at U (C:UsersMRSinghDesktopWebsitenode_modulesnextdistcompiledreact-server-dom-webpackcjsreact-server-dom-webpack-client.edge.production.min.js:22:53)
at c (C:UsersMRSinghDesktopWebsitenode_modulesnextdistcompiledreact-server-dom-webpackcjsreact-server-dom-webpack-client.edge.production.min.js:24:307)
Error occurred prerendering page "/shop/management". Read more: https://nextjs.org/docs/messages/prerender-error
SyntaxError: Unexpected token u in JSON at position 0
at JSON.parse (<anonymous>)
at U (C:UsersMRSinghDesktopWebsitenode_modulesnextdistcompiledreact-server-dom-webpackcjsreact-server-dom-webpack-client.edge.production.min.js:22:53)
at c (C:UsersMRSinghDesktopWebsitenode_modulesnextdistcompiledreact-server-dom-webpackcjsreact-server-dom-webpack-client.edge.production.min.js:24:307)
SyntaxError: Unexpected token u in JSON at position 0
at JSON.parse (<anonymous>)
at U (C:UsersMRSinghDesktopWebsitenode_modulesnextdistcompiledreact-server-dom-webpackcjsreact-server-dom-webpack-client.edge.production.min.js:22:53)
at c (C:UsersMRSinghDesktopWebsitenode_modulesnextdistcompiledreact-server-dom-webpackcjsreact-server-dom-webpack-client.edge.production.min.js:24:307)
SyntaxError: Unexpected token u in JSON at position 0
at JSON.parse (<anonymous>)
at U (C:UsersMRSinghDesktopWebsitenode_modulesnextdistcompiledreact-server-dom-webpackcjsreact-server-dom-webpack-client.edge.production.min.js:22:53)
at c (C:UsersMRSinghDesktopWebsitenode_modulesnextdistcompiledreact-server-dom-webpackcjsreact-server-dom-webpack-client.edge.production.min.js:24:307)
Error occurred prerendering page "/shop". Read more: https://nextjs.org/docs/messages/prerender-error
SyntaxError: Unexpected token u in JSON at position 0
at JSON.parse (<anonymous>)
at U (C:UsersMRSinghDesktopWebsitenode_modulesnextdistcompiledreact-server-dom-webpackcjsreact-server-dom-webpack-client.edge.production.min.js:22:53)
at c (C:UsersMRSinghDesktopWebsitenode_modulesnextdistcompiledreact-server-dom-webpackcjsreact-server-dom-webpack-client.edge.production.min.js:24:307)
Error occurred prerendering page "/shop/weekly". Read more: https://nextjs.org/docs/messages/prerender-error
SyntaxError: Unexpected token u in JSON at position 0
at JSON.parse (<anonymous>)
at U (C:UsersMRSinghDesktopWebsitenode_modulesnextdistcompiledreact-server-dom-webpackcjsreact-server-dom-webpack-client.edge.production.min.js:22:53)
at c (C:UsersMRSinghDesktopWebsitenode_modulesnextdistcompiledreact-server-dom-webpackcjsreact-server-dom-webpack-client.edge.production.min.js:24:307)
Error occurred prerendering page "/shop/quarterly". Read more: https://nextjs.org/docs/messages/prerender-error
SyntaxError: Unexpected token u in JSON at position 0
at JSON.parse (<anonymous>)
at U (C:UsersMRSinghDesktopWebsitenode_modulesnextdistcompiledreact-server-dom-webpackcjsreact-server-dom-webpack-client.edge.production.min.js:22:53)
at c (C:UsersMRSinghDesktopWebsitenode_modulesnextdistcompiledreact-server-dom-webpackcjsreact-server-dom-webpack-client.edge.production.min.js:24:307)
Error occurred prerendering page "/admin". Read more: https://nextjs.org/docs/messages/prerender-error
SyntaxError: Unexpected token u in JSON at position 0
at JSON.parse (<anonymous>)
at U (C:UsersMRSinghDesktopWebsitenode_modulesnextdistcompiledreact-server-dom-webpackcjsreact-server-dom-webpack-client.edge.production.min.js:22:53)
at c (C:UsersMRSinghDesktopWebsitenode_modulesnextdistcompiledreact-server-dom-webpackcjsreact-server-dom-webpack-client.edge.production.min.js:24:307)
Error occurred prerendering page "/shop/daily". Read more: https://nextjs.org/docs/messages/prerender-error
SyntaxError: Unexpected token u in JSON at position 0
at JSON.parse (<anonymous>)
at U (C:UsersMRSinghDesktopWebsitenode_modulesnextdistcompiledreact-server-dom-webpackcjsreact-server-dom-webpack-client.edge.production.min.js:22:53)
at c (C:UsersMRSinghDesktopWebsitenode_modulesnextdistcompiledreact-server-dom-webpackcjsreact-server-dom-webpack-client.edge.production.min.js:24:307)
info - Generating static pages (14/14)
> Export encountered errors on following paths:
/admin/page: /admin
/region/page: /region
/auth/page: /auth
/page: /
/shop/daily/page: /shop/daily
/shop/management/page: /shop/management
/shop/monthly/page: /shop/monthly
/shop/page: /shop
/shop/profile/page: /shop/profile
/shop/quarterly/page: /shop/quarterly
/shop/returns/page: /shop/returns
/shop/weekly/page: /shop/weekly
PS C:UsersMRSinghDesktopWebsite>
根据https://github.com/vercel/next.js/issues/48070,更新到金丝雀版本发布v13.3.1-canary。