Uncaught (in promise) ReferenceError: process is not defined
Hello everyone, i get this error when run index.html and access to (http://localhost:8000) in dist folder. I check "process" in the path ws-scrcp/scr/server/index.ts. Where is "process" from ? Can you help me, thank all you?
Hi. Can you provide the exact steps, what you do after cloning?
Hi. Can you provide the exact steps, what you do after cloning?
- After clone, i run "npm i" and "npm start" , it auto start a server localhost:8000.
- The command has created a folder called "dist". I go to the " dist" folder and open file html inside it.
- I check console it shows the error above.
After npm start just open http://localhost:8000/ in your browser.
There is no need to open files any files in "dist".
After
npm startjust openhttp://localhost:8000/in your browser. There is no need to open files any files in "dist".
Let see the picture, i running project by npm start, and access to localhost:8000 or 127.0.0.1:8000, it returns an error
This is weird.
You can build and development version:
-
npm run clean -
npm run dist:dev -
cd dist -
npm start
Source maps are enabled in this version, so it will be possible to see the place where the exception occurs.
But I am sure /src/server/index.ts has nothing to do with this. This file is not included in the client bundle.
But I am sure
/src/server/index.tshas nothing to do with this. This file is not included in the client bundle.

Frist test: I delete all older ws-scrcpy folder and clone new project. I follow your steps but still get error.
Second test: I continue delete project and clone second new project. I run "npm i" and add package "npm i path". Access to dist "cd dist" , run "npm start" and get the same error at the frist test
path and process are part of the node.js API.
There is no need for you to install them. When webpack builds the client it should use specific versions instead:
https://github.com/NetrisTV/ws-scrcpy/blob/ee87ba65258057e76af7c1e67e7e6633361a62cb/webpack/ws-scrcpy.common.ts#L105-L110
But I am sure
/src/server/index.tshas nothing to do with this. This file is not included in the client bundle.
Can you show me the result when we access the localhost:8000?
pathandprocessare part of the node.js API. There is no need for you to install them. When webpack builds the client it should use specific versions instead:https://github.com/NetrisTV/ws-scrcpy/blob/ee87ba65258057e76af7c1e67e7e6633361a62cb/webpack/ws-scrcpy.common.ts#L105-L110
I think in Readme it is lack of guide. Because after we run server , we have to run command "adb forward tcp:8886 tcp:8886" and connect to the url with several param look like: http://127.0.0.1:8000/#!action=stream&udid=R9HT10HL56R&player=broadway&ws=ws%3A%2F%2F127.0.0.1%3A8887%2F .
Can you show me the result when we access the localhost:8000?

I think in Readme it is lack of guide. Because after we run server , we have to run command "adb forward tcp:8886 tcp:8886" and connect to the url with several param look like: http://127.0.0.1:8000/#!action=stream&udid=R9HT10HL56R&player=broadway&ws=ws%3A%2F%2F127.0.0.1%3A8887%2F .
This is not necessary. Something is wrong with your build. I am sure it has something to do with webpack, but not sure what exactly.
