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

Uncaught (in promise) ReferenceError: process is not defined #262

Open
tiennguyen12g opened this issue Mar 29, 2023 · 12 comments
Open

Uncaught (in promise) ReferenceError: process is not defined #262

tiennguyen12g opened this issue Mar 29, 2023 · 12 comments

Comments

@tiennguyen12g
Copy link

tiennguyen12g commented Mar 29, 2023

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?

@drauggres
Copy link
Collaborator

Hi. Can you provide the exact steps, what you do after cloning?

@tiennguyen12g
Copy link
Author

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.

@drauggres
Copy link
Collaborator

After npm start just open http://localhost:8000/ in your browser.
There is no need to open files any files in "dist".

@tiennguyen12g
Copy link
Author

After npm start just open http://localhost:8000/ in your browser. There is no need to open files any files in "dist".
image

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

@drauggres
Copy link
Collaborator

This is weird.

You can build and development version:

  1. npm run clean
  2. npm run dist:dev
  3. cd dist
  4. npm start

Source maps are enabled in this version, so it will be possible to see the place where the exception occurs.

@drauggres
Copy link
Collaborator

But I am sure /src/server/index.ts has nothing to do with this. This file is not included in the client bundle.

@tiennguyen12g
Copy link
Author

tiennguyen12g commented Mar 30, 2023

But I am sure /src/server/index.ts has nothing to do with this. This file is not included in the client bundle.

image

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

@drauggres
Copy link
Collaborator

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:

resolve: {
fallback: {
path: 'path-browserify',
},
extensions: ['.tsx', '.ts', '.js'],
},

@tiennguyen12g
Copy link
Author

But I am sure /src/server/index.ts has 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?

@tiennguyen12g
Copy link
Author

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:

resolve: {
fallback: {
path: 'path-browserify',
},
extensions: ['.tsx', '.ts', '.js'],
},

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 .

@drauggres
Copy link
Collaborator

Can you show me the result when we access the localhost:8000?

262

@drauggres
Copy link
Collaborator

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.

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

2 participants