codeapp icon indicating copy to clipboard operation
codeapp copied to clipboard

Program interrupted. This could be caused by a memory limit or an error in your code.

Open JhunDigal opened this issue 1 year ago • 16 comments

Wasn’t able to use this app at all even with a very basic code!

JhunDigal avatar Apr 20 '23 09:04 JhunDigal

Same issue here, can‘t execute the „Creating a Node.js“ sample project.

MarZim81 avatar Apr 22 '23 19:04 MarZim81

Let me know your device model and the iOS version for me to reproduce this problem.

bummoblizard avatar Apr 23 '23 00:04 bummoblizard

Sorry, totally forgot. Device: iPad Pro M2 Gen 6 iOS: 16.4.1

Same issue on my iPhone 13 with same iOS version.

MarZim81 avatar Apr 23 '23 05:04 MarZim81

I also encountered this situation, and when using the npm i installation package, this error was reported. Device: iPad mini6 IOS:15.4.1

hezhenwen502 avatar Apr 26 '23 13:04 hezhenwen502

让我知道您的设备型号和iOS版本,以便我重现此问题。

I also encountered this situation, and when using the npm i installation package, this error was reported. Device: iPad mini6 IOS:15.4.1

hezhenwen502 avatar Apr 26 '23 13:04 hezhenwen502

same error here

ppercent avatar May 25 '23 19:05 ppercent

Same issue. I think it just comes down to a limitation of this app for error handling.

TLDR

This error is telling you there's a problem with your code, but the app cannot tell you what that problem is, or what file and line it's coming from in many cases.

Examples

Here's some examples in Node.js:

  1. Running nodemon app.js ERROR: Program interrupted. This could be caused by a memory limit or an error in your code Solution: Just use node app.js. Installing nodemon globally or as an app dependency doesn't work. You can't use nodemon with this platform. And it just doesn't know how to tell you that.

  2. Running node app.js with node package "Mongoose" ERROR: Program interrupted. This could be caused by a memory limit or an error in your code Solution: In my case, I was using deprecated syntax from an old version of mongoose. Just had to guess that was the problem and update per the docs. This error is explained in VSCode. But this app is missing something to show that output.

  3. Stopping a node app with ctrl-c ERROR: Program interrupted. This could be caused by a memory limit or an error in your code Solution: This is weird. There really is no problem. I'm just stopping the process like normal. But this app handles it like something went wrong. Kinda misleading.

Conclusion

Most desktop IDE/Editor solutions will tell you at least what file the problem is coming from. But in many cases, both the terminal and console output just can't offer any helpful hints. And speaking of the console (listed simply as 'problems' in the editor), well it has no badge or color to tell you one when an error has occurred.

I'm thrilled that something like this app even exists for iOS. Let alone one that is free and privacy respecting. We just need more detailed error handling to make this usable for daily work.

Device: iPad Pro 3rd Gen
OS: iPadOS 16.5
Code App Version: 1.4.4

zaychika avatar Jun 21 '23 00:06 zaychika

Same error here… doesn't support creating new angular and react projects?

RenzoAlessandro avatar Jun 30 '23 00:06 RenzoAlessandro

I tried it with a very-very simple react project and i got the same. Something is broken in the application.

Device: iPad Pro 3rd Gen OS: iPadOS 17.0 (Beta 4) Code App Version: 1.4.5

Envo avatar Aug 03 '23 11:08 Envo

I tried it with a very-very simple react project and i got the same. Something is broken in the application.

Device: iPad Pro 3rd Gen

OS: iPadOS 17.0 (Beta 4)

Code App Version: 1.4.5

Please use our React sample as a starting point: https://github.com/thebaselab/react-starter.

bummoblizard avatar Aug 03 '23 12:08 bummoblizard

I tried it with a very-very simple react project and i got the same. Something is broken in the application.

Device: iPad Pro 3rd Gen

OS: iPadOS 17.0 (Beta 4) Code App Version: 1.4.5

Please use our React sample as a starting point: https://github.com/thebaselab/react-starter.

Yeah that's run, but what's the point if my own projects isn't...

Envo avatar Aug 06 '23 21:08 Envo

I tried it with a very-very simple react project and i got the same. Something is broken in the application.

Device: iPad Pro 3rd Gen

OS: iPadOS 17.0 (Beta 4)

Code App Version: 1.4.5

Please use our React sample as a starting point: https://github.com/thebaselab/react-starter.

Yeah that's run, but what's the point if my own projects isn't...

You can. It's just certain commands aren't available on Code App because of iOS's restriction. Usually, they try to spawn sub-processes.

You might send me a copy of your project at [email protected] and I will patch it for you.

bummoblizard avatar Aug 06 '23 23:08 bummoblizard

I tried it with a very-very simple react project and i got the same. Something is broken in the application.

Device: iPad Pro 3rd Gen

OS: iPadOS 17.0 (Beta 4)

Code App Version: 1.4.5

Please use our React sample as a starting point: https://github.com/thebaselab/react-starter.

Yeah that's run, but what's the point if my own projects isn't...

You can. It's just certain commands aren't available on Code App because of iOS's restriction. Usually, they try to spawn sub-processes.

You might send me a copy of your project at [email protected] and I will patch it for you.

I take your answer as a kind joke. :) Of course i won't going to share these projects mostly because of security concerns...

Envo avatar Aug 07 '23 08:08 Envo

I tried it with a very-very simple react project and i got the same. Something is broken in the application.

Device: iPad Pro 3rd Gen

OS: iPadOS 17.0 (Beta 4)

Code App Version: 1.4.5

Please use our React sample as a starting point: https://github.com/thebaselab/react-starter.

Yeah that's run, but what's the point if my own projects isn't...

You can. It's just certain commands aren't available on Code App because of iOS's restriction. Usually, they try to spawn sub-processes.

You might send me a copy of your project at [email protected] and I will patch it for you.

Can you prrovide more info in wiki about starting node project in app? About app limitations, possible errors and how to start hevier that small epress eample apps. I believe this will help to prevent a lot of possible questions in the future

Flmob avatar Sep 28 '23 06:09 Flmob

I seem to have found a solution by wrapping my code in a try/catch block, and just console.logging/console.error-ing the error out (process.on("unhandledException", ...) and process.on("unhandledRejection", ...) did not work).

Though that alone won't work with async code. Instead, I suggest you wrap your whole program in a function, export it, and then use a new entry file like so:

// bootstrap.js
try {
  const { myWrappedProgram } = require("./myprogram.js")
  const result = myWrappedProgram()
  
  if (result && typeof result === "object" && "then" in result) {
    result.then(() => {}, console.error)
  }
}
catch (error) {
  console.error(error)
}

// myprogram.js
module.exports = { myWrappedProgram }

async function myWrappedProgram() {
  // ...
}

// to automatically start when the script is directly run via "node myprogram.js":
if (typeof require !== 'undefined' && require.main === module) {
    myWrappedProgram();
}

Now you start like so: node bootstrap.js.

I think it's actually really silly we have to do this, but until a fix is avaiable, this is better than nothing.

adamszigeti avatar Oct 14 '23 10:10 adamszigeti

Thanks all for the discussion. While it is not perfect, https://github.com/thebaselab/codeapp/commit/b0c6519b2340743b4afa7f8a968008c1c7eef39e should make uncaught errors reported properly. Additionally, node version is now updated to 18.

image

bummoblizard avatar Jan 04 '24 15:01 bummoblizard