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

frontend not working on macos #42

Closed
yadavj2008 opened this issue Oct 27, 2023 · 12 comments
Closed

frontend not working on macos #42

yadavj2008 opened this issue Oct 27, 2023 · 12 comments
Labels
deploy Deployment questions or suggestions

Comments

@yadavj2008
Copy link

While trying to setup frontend on MacOS, i'm getting below error, looks like it is coming from pdfjs lib due to undefined variable but couldn't able to solve this. Can someone assist on this please?

MacOS: ventura 13

node --version
v21.1.0

npm --version
10.2.0

error - TypeError: Cannot read properties of undefined (reading 'includes') at get platform [as platform] (/Users/pappuboss/OpenAgents/frontend/node_modules/pdfjs-dist/build/pdf.js:4222:23) at new KeyboardManager (/Users/pappuboss/OpenAgents/frontend/node_modules/pdfjs-dist/build/pdf.js:4202:35) at <static_initializer> (/Users/pappuboss/OpenAgents/frontend/node_modules/pdfjs-dist/build/pdf.js:4369:29) at Object.defineProperty.value (/Users/pappuboss/OpenAgents/frontend/node_modules/pdfjs-dist/build/pdf.js:4342:22) at __w_pdfjs_require__ (/Users/pappuboss/OpenAgents/frontend/node_modules/pdfjs-dist/build/pdf.js:19477:41) at Object.defineProperty.value (/Users/pappuboss/OpenAgents/frontend/node_modules/pdfjs-dist/build/pdf.js:3737:14) at __w_pdfjs_require__ (/Users/pappuboss/OpenAgents/frontend/node_modules/pdfjs-dist/build/pdf.js:19477:41) at Object.defineProperty.value (/Users/pappuboss/OpenAgents/frontend/node_modules/pdfjs-dist/build/pdf.js:3562:15) at __w_pdfjs_require__ (/Users/pappuboss/OpenAgents/frontend/node_modules/pdfjs-dist/build/pdf.js:19477:41) at Object.defineProperty.value (/Users/pappuboss/OpenAgents/frontend/node_modules/pdfjs-dist/build/pdf.js:1119:27) at __w_pdfjs_require__ (/Users/pappuboss/OpenAgents/frontend/node_modules/pdfjs-dist/build/pdf.js:19477:41) at /Users/pappuboss/OpenAgents/frontend/node_modules/pdfjs-dist/build/pdf.js:19718:12 at /Users/pappuboss/OpenAgents/frontend/node_modules/pdfjs-dist/build/pdf.js:19767:3 at /Users/pappuboss/OpenAgents/frontend/node_modules/pdfjs-dist/build/pdf.js:19770:12 at webpackUniversalModuleDefinition (/Users/pappuboss/OpenAgents/frontend/node_modules/pdfjs-dist/build/pdf.js:25:20) at Object.<anonymous> (/Users/pappuboss/OpenAgents/frontend/node_modules/pdfjs-dist/build/pdf.js:32:3) at Module._compile (node:internal/modules/cjs/loader:1376:14) at Module._extensions..js (node:internal/modules/cjs/loader:1435:10) at Module.load (node:internal/modules/cjs/loader:1207:32) at Module._load (node:internal/modules/cjs/loader:1023:12) at Module.require (node:internal/modules/cjs/loader:1235:19) at require (node:internal/modules/helpers:176:18) at Object.<anonymous> (/Users/pappuboss/OpenAgents/frontend/node_modules/react-pdf/dist/cjs/entry.js:27:37) at Module._compile (node:internal/modules/cjs/loader:1376:14) at Module._extensions..js (node:internal/modules/cjs/loader:1435:10) at Module.load (node:internal/modules/cjs/loader:1207:32) at Module._load (node:internal/modules/cjs/loader:1023:12) at Module.require (node:internal/modules/cjs/loader:1235:19) at require (node:internal/modules/helpers:176:18) at react-pdf (/Users/pappuboss/OpenAgents/frontend/.next/server/pages/index.js:1620:18) at __webpack_require__ (/Users/pappuboss/OpenAgents/frontend/.next/server/webpack-runtime.js:33:42) at eval (webpack-internal:///./pages/api/home/home.tsx:12:67) at __webpack_require__.a (/Users/pappuboss/OpenAgents/frontend/.next/server/webpack-runtime.js:97:13) at eval (webpack-internal:///./pages/api/home/home.tsx:1:21) at ./pages/api/home/home.tsx (/Users/pappuboss/OpenAgents/frontend/.next/server/pages/index.js:733:1) at __webpack_require__ (/Users/pappuboss/OpenAgents/frontend/.next/server/webpack-runtime.js:33:42) at eval (webpack-internal:///./pages/api/home/index.ts:7:63) at __webpack_require__.a (/Users/pappuboss/OpenAgents/frontend/.next/server/webpack-runtime.js:97:13) at eval (webpack-internal:///./pages/api/home/index.ts:1:21) at ./pages/api/home/index.ts (/Users/pappuboss/OpenAgents/frontend/.next/server/pages/index.js:744:1) at __webpack_require__ (/Users/pappuboss/OpenAgents/frontend/.next/server/webpack-runtime.js:33:42) at eval (webpack-internal:///./pages/index.tsx:7:67) at __webpack_require__.a (/Users/pappuboss/OpenAgents/frontend/.next/server/webpack-runtime.js:97:13) at eval (webpack-internal:///./pages/index.tsx:1:21) at ./pages/index.tsx (/Users/pappuboss/OpenAgents/frontend/.next/server/pages/index.js:755:1) at __webpack_require__ (/Users/pappuboss/OpenAgents/frontend/.next/server/webpack-runtime.js:33:42) at __webpack_exec__ (/Users/pappuboss/OpenAgents/frontend/.next/server/pages/index.js:1806:39) at /Users/pappuboss/OpenAgents/frontend/.next/server/pages/index.js:1807:28 at Object.<anonymous> (/Users/pappuboss/OpenAgents/frontend/.next/server/pages/index.js:1810:3) at Module._compile (node:internal/modules/cjs/loader:1376:14) { page: '/'

@BlankCheng
Copy link
Contributor

Hi, I think there's a similar issue about pdf-js in #24. Could you try that solution and tell us if that works?

@BlankCheng BlankCheng added the deploy Deployment questions or suggestions label Oct 27, 2023
@yadavj2008
Copy link
Author

I think the above issue seems different, though I have tried latest pydantic lib with python 3.10 and 3.11 but facing same issue as I mentioned earlier.

conda list |grep pydantic
openapi-schema-pydantic 1.2.4 pypi_0 pypi
pydantic 2.4.2 pypi_0 pypi
pydantic-core 2.10.1 pypi_0 pypi

@yadavj2008
Copy link
Author

I was able to solve pdfjs error issue by using react-pdf version 7.0.0 lib but now stuck on below error. I tried several version on echarts lib but not able to solve. Does anyone here able to run full backend and frontend on macos?. If yes, then can you please share the package.json file?. It looks to be libs mismatch problem.

error - ReferenceError: window is not defined at detect (/Users/jitendrayadav/OpenAgents/frontend/node_modules/echarts/dist/echarts.js:123:54) at /Users/jitendrayadav/OpenAgents/frontend/node_modules/echarts/dist/echarts.js:97:9 at /Users/jitendrayadav/OpenAgents/frontend/node_modules/echarts/dist/echarts.js:22:68 at Object.<anonymous> (/Users/jitendrayadav/OpenAgents/frontend/node_modules/echarts/dist/echarts.js:25:2) at Module._compile (node:internal/modules/cjs/loader:1376:14) at Module._extensions..js (node:internal/modules/cjs/loader:1435:10) at Module.load (node:internal/modules/cjs/loader:1207:32) at Module._load (node:internal/modules/cjs/loader:1023:12) at Module.require (node:internal/modules/cjs/loader:1235:19) at require (node:internal/modules/helpers:176:18) at Object.echarts (/Users/jitendrayadav/OpenAgents/frontend/.next/server/pages/index.js:1422:18)

@WhiteWolf82
Copy link
Contributor

Hi @yadavj2008, I'm on macos and the package.json works fine for me.
macOS: Sonoma 14.0
node: 18.7.0
npm: 8.15.0

@WhiteWolf82
Copy link
Contributor

I think the installing errors you encountered might be related to some other existing packages in your nodejs environment, maybe you can try switching to a new environment by using tools like nvm.

@miandai
Copy link

miandai commented Oct 29, 2023

I encountered the same problem and still haven't solved it

@samantha0-ops
Copy link

I was able to solve pdfjs error issue by using react-pdf version 7.0.0 lib but now stuck on below error. I tried several version on echarts lib but not able to solve. Does anyone here able to run full backend and frontend on macos?. If yes, then can you please share the package.json file?. It looks to be libs mismatch problem.

error - ReferenceError: window is not defined at detect (/Users/jitendrayadav/OpenAgents/frontend/node_modules/echarts/dist/echarts.js:123:54) at /Users/jitendrayadav/OpenAgents/frontend/node_modules/echarts/dist/echarts.js:97:9 at /Users/jitendrayadav/OpenAgents/frontend/node_modules/echarts/dist/echarts.js:22:68 at Object.<anonymous> (/Users/jitendrayadav/OpenAgents/frontend/node_modules/echarts/dist/echarts.js:25:2) at Module._compile (node:internal/modules/cjs/loader:1376:14) at Module._extensions..js (node:internal/modules/cjs/loader:1435:10) at Module.load (node:internal/modules/cjs/loader:1207:32) at Module._load (node:internal/modules/cjs/loader:1023:12) at Module.require (node:internal/modules/cjs/loader:1235:19) at require (node:internal/modules/helpers:176:18) at Object.echarts (/Users/jitendrayadav/OpenAgents/frontend/.next/server/pages/index.js:1422:18)

I meet the same problem as you(echarts caused some error) . Then I tried to reinstall node and npm, but this problem can still not be solved. My node version is v21.1.0, npm version is 10.2.0. Do you have other solution yet?

@ztjhz
Copy link
Contributor

ztjhz commented Oct 30, 2023

Hi, it seems the pdfjs is running in node environment instead of browser environment. Could you double check the frontend script to install and run, npm install and npm run dev, which result in correct env in our test?

If it still does not work, you could comment out the code related to pdfjs, as our frontend no longer supports pdf.

@caizhuoyue77
Copy link

Hi @yadavj2008, I'm on macos and the package.json works fine for me. macOS: Sonoma 14.0 node: 18.7.0 npm: 8.15.0

I changed my node and npm version to match yours and it worked!

@yadavj2008
Copy link
Author

Worked with node: 18.7.0 npm: 8.15.0 version

@BlankCheng
Copy link
Contributor

Btw, it seems to be a known issue for node 21.0, please refer to this issue apache/echarts#19233

@BlankCheng
Copy link
Contributor

Worked with node: 18.7.0 npm: 8.15.0 version

This solution worked for the echarts issue.

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

No branches or pull requests

7 participants