NativeScript / nativescript-dev-webpack

A package to help with webpacking NativeScript apps.
Apache License 2.0
97 stars 49 forks source link

Fresh install cannot run debug on android #958

Closed sevanskey closed 4 years ago

sevanskey commented 5 years ago

Environment

package.json and webpack.config.js here.

Describe the bug Clean installs and I cannot run or debug android. Works perfectly fine debugging on android studio, however webpack is throwing an error every time in vscode. The project builds okay, I can copy the APK over and it runs as expected. However whether running on a connected physical device or emulator webpack is outputting the following:

Hook skipped because bundling is in progress. Running webpack for Android... child_process.js:110 p.open(fd); ^

Error: EBADF: bad file descriptor, uv_pipe_open at Object.exports._forkChild (child_process.js:110:5) at Object.setupChannel (internal/process.js:247:8) at startup (bootstrap_node.js:64:16) at bootstrap_node.js:609:3 Executing webpack failed with exit code 1.

Have done multiple clean installs and still getting the same issue. Have searched for the direct code causing this issue in my dir and cannot find it at all. Also to note have followed the process for updating nativescript-webpack-dev posted here with no success.

To Reproduce My steps were following:

Expected behavior

Should launch debug version of the app on device/emulator.

DimitarTachev commented 5 years ago

Hi @sevanskey,

It seems that NodeJs is not able to spawn the Webpack child process on your machine.

Maybe the OS is rejecting the IPC socket. Could you try with tns run android --no-watch? (this will spawn the Webpack child process without IPC)

You can also validate this with the following NodeJs test.

1) Create index.js:

const spawn = require('child_process').spawn
const path = require('path')

let childPath = path.join(__dirname, 'child.js')
spawn("node", [childPath], {
    stdio: ["inherit", "inherit", "inherit", "ipc"],
})

2) Create child.js in the same folder:

console.log("Hello from the Child Process!");

3) Execute node index.js in the same folder. 4) If you get the same exception, try removing the ipc from the stio array.