No internet connection
  1. Home
  2. How to

Module not Found After 'Copy Command ID Local to Package'

By Julian Worden @McJulian
    2024-03-19 20:29:41.711Z

    Currently, I'm working within a package called Test. This package has two Commands (Scripts) inside of it: "Test1" and "Test2".

    Test1 has the following code: module.exports.exportingTest = 7;

    Test2 has the following code: var testModule = require('package:cltysuhgt0003r110rrlojkeb');

    I got the 'package:cltysuhgt0003r110rrlojkeb' string by selecting the Test1 script and clicking Command > Copy Command ID Local to Package. I also tried using the string from Command > Copy Command ID. Either way, I get an error on the 'package:cltysuhgt0003r110rrlojkeb'string that says:

    Cannot find module 'package:cltysuhgt0003r110rrlojkeb'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option?
    

    Here's a screenshot of how my packages and scripts are laid out in the file browser:

    It's as if my Test2 script just can't see my Test1 script. Any suggestions would be much appreciated!

    Solved in post #6, click to view
    • 10 replies
    1. Kitch Membery @Kitch2024-03-19 20:49:21.919Z

      Hi @McJulian,

      I believe the issue here is that you are not de-structuring the require call.

      Try changing the require line in your Test2 script to the following.

      const { exportingTest } = require('package:cltysuhgt0003r110rrlojkeb');
      

      I've not tested this, so let me know if you need further guidance.

      Rock on! :-)

      1. MJulian Worden @McJulian
          2024-03-19 20:56:48.151Z

          @Kitch Thanks for the response!

          Unfortunately, I had already tried this and it doesn't fix the issue, it's still as if SoundFlow just doesn't see 'package:cltysuhgt0003r110rrlojkeb' and I get the same error I mentioned before.

          1. Kitch Membery @Kitch2024-03-19 20:59:31.351Z

            I'll take a look and see if I can recreate the issue. :-)

            1. In reply toMcJulian:
              Kitch Membery @Kitch2024-03-19 21:23:12.442Z
              Reply1 LikeSolution
              1. In reply toMcJulian:
                Kitch Membery @Kitch2024-03-19 21:33:24.011Z
                1. MJulian Worden @McJulian
                    2024-03-19 23:10:40.240Z

                    @Kitch Thank you so much for your time on this!

                    It looks like my lack of very much experience with JavaScript combined with that error message was confusing me, after following the steps in your videos everything is working now and I have a better understanding of how different scripts can work together.

                    Thanks again for your very prompt help!

                    1. Kitch Membery @Kitch2024-03-19 23:11:59.275Z

                      You're welcome, Julian! Glad I could help you out!

              2. In reply toMcJulian:
                Kitch Membery @Kitch2024-03-19 20:52:08.877Z

                The following post may be helpful to you, as we can now import type definitions. :-)

                1. In reply toMcJulian:

                  Hi Julian,

                  This error is merely the syntax highlighting not working with this style of using require:

                  Cannot find module 'package:cltysuhgt0003r110rrlojkeb'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option?
                  

                  It would actually run the code just fine.

                  You can use the newer require syntax to get syntax highlighting working well:

                  1. MJulian Worden @McJulian
                      2024-03-19 23:12:41.057Z

                      @chrscheuer Thanks, Christian! Yes, Kitch brought that to my attention in our thread above. I was just misunderstanding the error, I'm all good now and I'll be sure to give that newer syntax a shot. I appreciate your time!