Installed module not found in Titanium - javascript

I am having troubles using a module I have added to Titanium. I followed the official directions to install a module (more specifically this module: https://github.com/appcelerator/titanium_modules/tree/master/udp/mobile/android):
I have installed the ti.udp-android-2.1.2.zip file via help>Install Mobile Module
Then I added the ti.udp module to the tiapp.xml (since it was directly found and could be selected from the list, I assume the install of the module was successful).
I load the module with
var UDP = require('ti.udp');
Every time I start the application, I get the error:
Uncaught Error: Requested module not found: ti.udp
update
Image of the tiapp.xml:

Please go to tiapp.xml and see whether the module is being shown there.I don't think that your module added in tiapp.xml
Thanks

Your modules should be installed under %User%/AppData/Roaming/Titanium/modules
You can also verify what is your titanium sdk path in TitaniumStudio Window->Preference->Platform
I suspect that the tiapp.xml gets the modules from the Titanium Path, but the build will look for it in the User's path. That's why you do see it in the editor, but can't build

Related

A file called pty.node.js is missing after installing "node-pty" in a electron-forge project. How can I install node-pty in Linux

After installing node-pty (an external module used to create pseudo terminals using node js) in a boilerplate electron-forge project; I found it throwing an error that some core module of node-pty is importing another module which nodejs is failing to find.
After some research I discovered that entry point of node-pty is src/index.js, which imports another module called src/unixTerminal.js (this file is imported if the system is running on linux platform and my PC is running on Ubuntu 20.04) and that module tries to import build/Releases/pty.node.js (unixTerminal.js calls many functions imported from pty.node.js, so this package cannot be ommitted) but as a matter of fact build/Releases/pty.node.js is missing and completely absent in the node_modules/node-pty folder of my project where I had installed node-pty
Why does this happen? Is this any fault of myself in installing node-pty, I had installed it directly using npm i command? If a vital file of a module is missing how can it work? Please tell me how can I use node-pty on Linux and why build/Releases/pty.node.js is missing in node-pty's directory?
Since you're using Electron Forge (a crucial detail omitted from the original post), according to this issue I found by googling "node-pty electron forge" you'll need to configure the Electron packager to unpack the pty.node file:
asar: {
unpack: '**/node_modules/node-pty/build/Release/*'
},

Unable To Run Android React-Native App Due to CMake Path Versions

I am trying to run my react-native application but whenver i do it crashes and gives me this error:
Could not determine the dependencies of task ':react-native-reanimated:generateJsonModelDebug'.
> CMake '3.18.1' was not found in PATH or by cmake.dir property.
CMake '3.22.4' found in PATH did not match requested version '3.18.1'.
I don't understand what this means, i believe it has something to do with the react-native-reanimated package. this package has many issues and i do not know how to resolve them.
Any help?
It means you have to update the cmake version and export to your path directory.
Open Android Studio
Access SDK MANAGER
Access tools and found CMake
Click Show Package details
Then install the version 3.18.1

react-native package specifices a main module https module

I made a test project, only trying to include https. I used expo init test to initialize the project, then npm install https to install the library.
I then edited App.js and included this line at the very top: import {https} from 'https';
Finally expo start to start the expo server.
Now I get the following error:
InternalError Metro has encountered an error: While trying to resolve module `https` from file `/path/test/App.js`, the package `/path/test/node_modules/https/package.json` was successfully found. However, this package itself specifies a `main` module field that could not be resolved (`/path/test/node_modules/https/index.js`. Indeed, none of these files exist:
* /path/test/node_modules/https/index.js(.native|.android.expo.ts|.native.expo.ts|.expo.ts|.android.expo.tsx|.native.expo.tsx|.expo.tsx|.android.expo.js|.native.expo.js|.expo.js|.android.expo.jsx|.native.expo.jsx|.expo.jsx|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json|.android.wasm|.native.wasm|.wasm)
* /path/test/node_modules/https/index.js/index(.native|.android.expo.ts|.native.expo.ts|.expo.ts|.android.expo.tsx|.native.expo.tsx|.expo.tsx|.android.expo.js|.native.expo.js|.expo.js|.android.expo.jsx|.native.expo.jsx|.expo.jsx|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json|.android.wasm|.native.wasm|.wasm)
I've verified that these files do indeed not exist, here is the output of ls node_modules/https: package.json
So I'm guessing I did something wrong during the install process, however, I can't figure out what. (I've also tried several times to install using yarn add https, I got the same error)
The https module you want is almost certainly the Node.js built-in https module and is definitely not the six-year-old https npm module with no documentation or code and merely a lone package.json file. That package should probably be deprecated so people don't make this entirely understandable mistake.
In short, try npm uninstall https and see if your code starts working. It probably will.
If not and you really need some external module, it's definitely not that module. Look at one of the many many great http/https modules out there. #Nitish suggests axios in their answer and that is a popular and solid choice.
import {Agent} from 'https'; should work with the built-in https module assuming you're working with a reasonably recent version of Node.js. (You can quickly test your version of Node.js for this by putting that line of code in an index.mjs file and running node index.mjs. If there's no error message, it worked.)
Disclaimer: I know nothing about expo. This is all from a Node.js/npm perspective.
the error is clear that your package.json don't have https module.
I don't know why you need this module but if you need this for REST API I suggest fetch or if third party you can use axios.

ionic:Runtime Error Cannot find module "../pages/home/home"

I want to make an app in ionic, so I add some custom page in ionic by command :
ionic g page user
But I start ionic server it show error
Runtime Error Cannot find module "../pages/home/home"
click for error image
If the app tells you that it misses a file, that's because there's somewhere where you imported this file and it doesn't exist (anymore? maybe you deleted it and forgot to delete an import)
You should make a project-wide text search using grep or your favorite ide to find where you are importing "../pages/home/home".
Your error doesn't come from your ionic g page user command as this command only generates a page named user.
It seems like you created a page called home and deleted it without deleting imports.
I encountered the same problem when I was github clone code.
But this is not the problem with the code itself, but because I used cnpm (npm of the Chinese version).
Uninstall npm, install npm. The problem is solved

react-native-db-models Uncaught error

I am wanting to use the react-native-db-models for local-db on my React Native iOS app.
I've npm installed react-native-db-models from here and have followed the instructions on the page of creating a db.js file that contains the example given on both Github page and NPM page. Then in the file that needs access to the DB, I've created vars for both DB and DBEvents, following the docs accordingly.
When running the project in Xcode it results in a Build Fail.
uncaught error Error: UnableToResolveError: Unable to resolve module
util from /Users/tmhn/Project/DoppioHealth/node_modules/react-native-db-models/node_modules/promise-es6/lib/utils.js:
Invalid directory /Users/node_modules/util
I have also npm installed the two dependencies listed on the npm page: es6-promises and eventemitter3, to no avail.
Note: DoppioHealth is the project name
Investigated the Github Issues and found this solved the issue

Categories