I have built an electron app in Mac OS, when I try to export the package for windows and try to run it throws me following error:
Error Screenshot
My app uses sqlite3, I installed sqlite using following command:
npm install sqlite3 --build-from-source
My NODE_PATH is also set to the node_modules folder, also tried following commands:
npm install --save-dev electron-rebuild
# Every time you run "npm install", run this
./node_modules/.bin/electron-rebuild
But still I am not able to run sqlite3 on windows with electron
sqlite3 relies on node-pre-gyp, so you need to use the workaround provided in electron-rebuild when building sqlite3 for Electron.
Related
I have been using React-Native for a project it's been more than a month, to create the app I uninstalled the react-native-cli and followed what is described in the official docs (https://reactnative.dev/docs/environment-setup). Yesterday, I modified an existing project (from github) and run :
npm install
npx react-native run-android
I had some errors so I updated npm, everything worked fine. I restarted my computer and tried to create a new app using the following command:
npx react-native init Test
This is the error that I get:
I uninstalled Node and installed the newest version (16.0.0) with npm version (7.11.2) and npx version (7.11.2).
Can someone please help me with this?
Uninstalling global packages
use this commond
npm uninstall -g react-native-cli
then restart computer and try create new app
I restarted my computer and tried to create a new app using the following command: npx react-native run-android Test
to create new app in react native use init not run-android
npx react-native init Test
i think you need to install react native cli but first Add npm path to your Environment variables; both system and user then install npm and react-native cli.
and if that does not work,Solution is to install react-native-cli globally You can install it globally by using the below command:
npm install -g react-native-cli
So I installed vue cli 4.1.1 to get a new project going. I select manual setup so I can pick what I need. But when I try to run "npm run serve" I get the following error:
ERROR Failed to compile with 4 errors 10:59:53 These dependencies were not found: * #/components/HelloWorld.vue in C:/Program Files/nodejs/node_modules/#vue/cli-service-global/node_modules/babel-loader/lib??ref--12-0!C:/Program Files/nodejs/node_modules/#vue/cli-service-global/node_modules/cache-loader/dist/cjs.js??ref--0-0!C:/Program Files/nodejs/node_modules/#vue/cli-service-global/node_modules/vue-loader/lib??vue-loader-options!./views/Home.vue?vue&type=script&lang=js& * register-service-worker in ./registerServiceWorker.js * vue-router in ./router/index.js * vuex in ./store/index.js To install them, you can run: npm install --save #/components/HelloWorld.vue register-service-worker vue-router vuex
All the files are at the right place. I havn't done anything to the project besides removing node_modules and reinstalling it with "npm install". (Had to do this to get rid of another error)
I am runnig Windows 10, Node 10.15.1, NPM 5.0.4 and vue-cli 4.1.1
What troubles me the most is that it's just regular vue files and not packages. Why it suggests that I should install them with npm install is something I find odd.
As you chose manual option you have to create a file in components directory name as HelloWorld.vue
After the above step run npm install --save register-service-worker vue-router vuex
Have you run this command as described.
npm install --save #/components/HelloWorld.vue register-service-worker vue-router vuex
My task is to build a HTML5 desktop app, which works with serial port, because I have an arduino on the other side on COM-port.
I installed electron-prebuilt and serialport packages both (I specified them in package.json).
In my main web page I included main.js, and there I tried to require the serialport package, but I got the following error:
Uncaught Error: Cannot find module
'D:\Projects\arduino\HTMLPresentation\node_modules\serialport\build\serialport\v1.7.4\Release\node-v45-win32-x64\serialport.node'
I've read some QA topics about that problem (some abracadabras with node-gyp), but noting works for me: on both windows 8.1 and Ubuntu 15.04. I don't know how to adopt serialport package for electron.
My enviroment:
Vue.js: 2.6.10
Electron: 2.0.18
Node: 8.9.3
Platform: linux
If you are using Eletron with Vue.js you need to rebuild the serialport module doing something like this:
npm install electron-rebuild --save-dev
after this, you can add in your package.json > section "scripts", another line saying:
"rebuild": "electron-rebuild -f -w serialport"
You can rebuild the module with terminal command
npm run rebuild
Now the serialport module should be imported and will work as expected. Goog luck!
Use Electron-Rebuild: This executable rebuilds native io.js modules against the version of io.js that your Electron project is using. This allows you to use native io.js modules in Electron apps without your system version of io.js matching exactly.
npm install --save-dev electron-rebuild
# Every time you run "npm install", run this
./node_modules/.bin/electron-rebuild
# On Windows if you have trouble, try:
.\node_modules\.bin\electron-rebuild.cmd
This is how you would solve it
Install windows build tools in your computer by running this in your powershell with administrator access
npm install --global --production windows-build-tools
or npm --add-python-to-path='true' --debug install --global windows-build-tools
setx PYTHON "%USERPROFILE%\.windows-build-tools/python27/python.exe"
set PYTHON
set PYTHON helps you check if its set up correctly.
This is not enough install electron rebuild globally in your project files
npm install -g electron-prebuilt
npm install --save serialport
We have to rebuild serialport to work with electron. To do this, we need to >install electron-rebuild:
npm install --save-dev electron-rebuild
The last step is to run electron-rebuild, once again, just in the root >directory of the app:
./node_modules/.bin/electron-rebuild
import and use in your electron-vue project
<script>
const sp = require('serialport')
export default {
name: 'landing-page',
methods: {},
created () {
sp.list(function (error, ports) {
if (error) {
console.log(error)
} else {
console.log(ports)
}
})
}
}
</script>
I am trying to install express module install, but the issue is that after installation I am still unable to use express.
What I've done:
Install express using cmd - npm install -g express
For some reason it's not installing globally.
Help?
You might want to use the following:
npm install -g express-generator
Source: Issues with installing Express.JS in Windows 7
In later versions of express comand line was migrated to a separate module: express-generetor
use
npm install -g express-generator#3
and could use the express command
Have installed Node version manager 'n'.
Installed 'mocha' using
n npm 0.6.4 install mocha -g.
Now when I try to access it using
mocha -R spec
I get an error 'command not found'. Is there some option I'm missing.
'n' is the version manager and not the package manager. In other words, you use 'n' to install different versions of NodeJS. You'll use npm to install packages like mocha.
Type n 0.6.4 will install NodeJS version 0.6.4 and set it in your path.
Type npm install mocha -g will install mocha as global module.
Run both the above commands in order, then you'll find mocha in your path.