I have a problem with an app based on electron. When I build my electron app with electron-builder it produces a appname.exe file which has probably the html/js/css sources in the exe file or another one in the produced directory. When I try to require a node_module from the developer console in the builded app, the module is not getting found :(.
The app is looking in a file called electron.asar liked it seems for the module. I don't really understand this because over modules are getting found, otherwise, the app would not be able to start anyhow.
Maybe one of you guy's have already faced that problem?
yes, the module needs to be listed in the dependencies section in the package.json to be found in the built electron app.
Related
I am trying to integrate 2 react apps I have been working on into 1 new react application (all created using npx create-react-app nameofapp) but I can not get the libraries I have used in the previous app to load/work in the new application even though I have copied the depencencies from the previous application and pasted in the new package.json file and run npm i and can see the folders for the libraries in node_modules folder of new application.
I am only importing fs in the js file from previous application at the moment and still get an error when running npm start which is module not found and it seems to be looking in the src file probably because the js file is in the src folder which is using import fs from "fs" to work with the fs package.
One other thing I can see different is that I had to run node app on previous application in src folder to start it where npm start runs this application.
I'd really appreciate help with this as I am still new to node and have been stuck all day on just integrating 2 applications into one.
I have a Shopware app I would like to submit to the store. The app uses some third party node modules (socket-io). However whenever I build the javascript, the compiled file in the dist folder of the app does not include my dependencies. When installing this app to a store I get the following error:
Uncaught TypeError: Cannot read properties of undefined (reading 'call')
Locally running bin/build-storefront.sh with the app activated fixes the issue, but not by including the dependecy javascript in the compiled js in my app's dist folder. I guess it includes it in the main shopware js file.
How can I have the node modules included properly?
I found the below issue which seems to be the same:
https://issues.shopware.com/issues/NEXT-15942
Please see the guide on adding NPM dependencies.
I put some common code in this local module called 'client-common'. In one of the app project using this common module, I add this to package.json dependencies:
"client-common": "../client-common"
After npm install the module gets copied to node_modules. When I run (it's an Ionic project) ionic serve, it builds all fine, but at runtime in the browser I get
Runtime Error
Cannot find module "client-common"
I'm assuming this is a webpack issue? The question is why is the local module treated differently and not bundled at all?
It seems that I was supposed to supply an index.js in the common module. After adding an index.js duplicated from the existing index.d.ts, exporting everything, it just works now.
I am learning building Node modules and packaging it with Electron. I've successfully built an module out of a CPP file and can run it with node. However, to run it with Electron I need to rebuild Electron. There are instructions out there, for example:
https://github.com/electron/electron/blob/v0.37.2/docs/tutorial/using-native-node-modules.md#using-native-node-modules
https://github.com/electron/electron/issues/2330
Here I have an addon.node file after running node-gyp build. I can reference it in the node application from anywhere: var addon = require('.Release\addon'); and it works fine. However, when I build Electron with it I don't understand where to put the .node file so that it is used in the build. Before I run node_modules\.bin\electron-rebuild (see bullet point 1 link above) where should I put the addon.node file? Is it right to say that before I even test it withing Electron (with console.log or something) I need to run electron-rebuild. Is there a step that I missing that I need to take from having the addon.node file to starting to build it into Electron?
Thank you.
I need to put this node.js module into Alloy project. It's a Facebook SDK node module.
I put the install command, and a node_module folder appear into my project folder, but I can't use it.
Where have I to put this node_module folder? Why the requires into facebook.js are not founded by the compiler?
Please, can anyone help me?
Titanium is not a pure NodeJS environment. When you use require('test') in a Titanium Alloy project, it will look for a file named test.js in the directory <Your project>/app/lib/.
Titanium can't handle a require on a directory with a package.json.
So if you want a pure NodeJS module, you'll have to put every files needed in the <Your project>/app/lib/ directory.
But keep in mind that you can't use a NodeJS module which depends on NodeJS API like requests, because there's no such things in Titanium (you have to Ti.HttpClient instead).