Nativescript: JS ERROR Error: Could not find module './' when debugging iOS app

Created on 4 Sep 2017  路  8Comments  路  Source: NativeScript/NativeScript

Please, provide the details below:

Did you verify this is a real problem by searching Stack Overflow and the other open issues in this repo?

Yes

Tell us about the problem

Please, ensure your title is less than 63 characters long and starts with a capital
letter.

Which platform(s) does your issue occur on?

iOS

Please provide the following version numbers that your issue occurs with:

  • CLI: 3.1.3
  • Cross-platform modules: 3.1.1
  • Runtime(s): iOS 3.1.0
  • Plugin(s): n/a

Please tell us how to recreate the issue in as much detail as possible.

Application prepares/builds, deploys to simulator, but fails to start displaying the following error in the console:

[native code]: JS ERROR Error: Could not find module './'. Computed path '/Users/gdereese/Library/Developer/CoreSimulator/Devices/15B2BE33-AE47-485D-9D8B-8B08F7CC6C3A/data/Containers/Bundle/Application/CE093ADC-5CFB-4D69-9A52-121B037460C8/nativescriptjserrordemo.app/app'.

ios question

Most helpful comment

I think I resolved the issue. Turns out I had deleted the package.json file that existed inside the /app folder thinking it was something that was only needed for the template used to seed the project. Once I put it back, the error was no longer reported.

All 8 comments

Hi @gdereese,
Please verify, if you are using latest LTS node version 6.11.2. Also, I found that in the project is missing the tsconfig.json file. could you add this file in the root project folder and to add the following content in it.
Then delete node_modules, platforms and hooks folder and try to rebuild the app.

{
    "compilerOptions": {
        "module": "commonjs",
        "target": "es5",
        "experimentalDecorators": true,
        "emitDecoratorMetadata": true,
        "noEmitHelpers": true,
        "noEmitOnError": true,
        "lib": [
            "es6",
            "dom",
            "es2015.iterable"
        ],
        "baseUrl": ".",
        "paths": {
            "*": [
                "./node_modules/tns-core-modules/*",
                "./node_modules/*"
            ]
        }
    },
    "exclude": [
        "node_modules",
        "platforms",
        "**/*.aot.ts"
    ]
}

Let me know, whether this helps or if I could assist you further.

Thanks. I previously had a more current Node.js installed, so I reverted it to 6.11.2, added the missing tsconfig.json, cleaned the requested directories and built again.

As before, the app builds successfully, but I still get the reported error when debugging the app in iOS.

I think I resolved the issue. Turns out I had deleted the package.json file that existed inside the /app folder thinking it was something that was only needed for the template used to seed the project. Once I put it back, the error was no longer reported.

i removed ios platform tns platform remove ios
and run again tns run ios
and it's ok !

Just wanted to say that for me, it was caused by not installing new node modules that were added in newer commits to the app. Deleting the node-modules folder and then running npm i fixed the issue.

@BRO-mesdocteurs BRO, you saved me. I was pulling my hair out. Thank you.

still not working for me after all the instruction above explained
i am using nativescript angular shared repo

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

NickIliev picture NickIliev  路  3Comments

pocesar picture pocesar  路  3Comments

dhanalakshmitawwa picture dhanalakshmitawwa  路  3Comments

minjunlan picture minjunlan  路  3Comments

guillaume-roy picture guillaume-roy  路  3Comments