Leaflet map offline - leaflet

I'm creating an app with Electron (the GitHub instrument to create apps with html and node.js).
This app will be used by some computer that they aren't connected to internet.
I need to show a map and collocate markers on it (I found Leaflet), but all maps service require internet.
With Open Street Maps I can export an osm file but I can't find a way to render it into Leaflet, because the only library for node (mapbox-gl-native-master) who do it require C++11 and it gives me error in installation:
$ npm install mapbox-gl-native
> mapbox-gl-native#3.2.1 preinstall /home/dpd-/node_modules/.staging/mapbox-gl-native-eb973ff7
> npm install node-pre-gyp
npm ERR! Linux 4.4.0-24-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "node-pre-gyp"
npm ERR! node v4.2.6
npm ERR! npm v3.5.2
npm ERR! Cannot read property 'target' of null
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm ERR! Please include the following file with any support request:
npm ERR! /home/dpd-/node_modules/.staging/mapbox-gl-native-eb973ff7/npm-debug.log
npm WARN enoent ENOENT: no such file or directory, open '/home /dpd-/package.json'
npm WARN dpd- No description
npm WARN dpd- No repository field.
npm WARN dpd- No README data
npm WARN dpd- No license field.
npm ERR! Linux 4.4.0-24-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "mapbox-gl-native"
npm ERR! node v4.2.6
npm ERR! npm v3.5.2
npm ERR! code ELIFECYCLE
npm ERR! mapbox-gl-native#3.2.1 preinstall: `npm install node-pre-gyp`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the mapbox-gl-native#3.2.1 preinstall script 'npm install node-pre-gyp'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the mapbox-gl-native package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! npm install node-pre-gyp
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs mapbox-gl-native
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls mapbox-gl-native
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /home/dpd-/npm-debug.log

Take a look at either Kothic or Mapnik, Both should be more than capable of handling offline osm files. I guess Kothic will be a tad easier to implement (pure JS), since Mapnik essentially is a C++ library with a node.js interface. Additionally, Kothic claims easy integration with Leaflet, so I imagine this should suit you quite well.

Related

Peer Dependency error while deploying to Vercel

I am trying to deploy my NextJS application onto Vercel but each time at the deploy stage, I am met with these errors and the deployment will fail:
Previous build cache not available
Cloning completed: 426.52ms
Running "vercel build"
Vercel CLI 28.6.0
Installing dependencies...
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: react-typed#1.2.0
npm ERR! Found: react#18.2.0
npm ERR! node_modules/react
npm ERR! react#"18.2.0" from the root project
npm ERR! peer react#"^18.2.0" from next#13.0.5
npm ERR! node_modules/next
npm ERR! next#"13.0.5" from the root project
npm ERR! 3 more (react-dom, react-icons, styled-jsx)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react#"^16.3.0" from react-typed#1.2.0
npm ERR! node_modules/react-typed
npm ERR! react-typed#"^1.2.0" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: react#16.14.0
npm ERR! node_modules/react
npm ERR! peer react#"^16.3.0" from react-typed#1.2.0
npm ERR! node_modules/react-typed
npm ERR! react-typed#"^1.2.0" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See /vercel/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /vercel/.npm/_logs/2022-12-02T16_42_09_037Z-debug-0.log
Error: Command "npm install" exited with 1
I have tried running npm install --legacy-peer-deps and tried redeploying onto Vercel, but the same issue persists. When I run this application on my localhost:3000 using npm run dev, the application renders fine. Anyone knows what I can do?
I have tried
npm install --legacy-peer-deps
and also pushing these changes onto my GitHub repository. When redeploying, the same issue still shows. I run
npm install --legacy-peer-deps
again, but this time, there are no more changes to be made.
you can override the installing command used by Vercel CLI, either by:
Going to Vercel Dashboard -> -> Settings -> General -> Scroll to Build & Development Settings and put npm install --legacy-peer-deps in Install Command
Creating vercel.json file in the root directory of your project that should contain:
// vercel.json
{
"installCommand": "npm install --legacy-peer-deps"
}
after that push and wait for deployment, it should go through this time
But I recommend looking for the cause of this issue. It seems like some dependency you're using is depending on react-typed, and the latter is not maintained anymore. It's better to seek an alternative

Ionic Capcitor build Android unable to resolve dependency tree

I am receiving an error when attempting to run ionic capacitor build android (details below):
PS C:\Users\User\source\repos\imango\src> ionic capacitor build android
npm.cmd i -E #capacitor/android#latest
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: mango#0.0.1
npm ERR! Found: #capacitor/core#3.7.0
npm ERR! node_modules/#capacitor/core
npm ERR! #capacitor/core#"^3.5.1" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer #capacitor/core#"^4.0.0" from #capacitor/android#4.0.1
npm ERR! node_modules/#capacitor/android
npm ERR! #capacitor/android#"4.0.1" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See C:\Users\User\AppData\Local\npm-cache\eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\User\AppData\Local\npm-cache_logs\2022-08-06T22_53_19_523Z-debug-0.log
[ERROR] An error occurred while running subprocess npm.
npm.cmd i -E #capacitor/android#latest exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.
Your capacitor cli version is still set at 3.6.0 in your
devDependencies, try changing that to ^4.0.1 and clearing your
node_modules and removing your package-lock.json and run npm install
again.
Check this
Copied from her:
https://github.com/ionic-team/capacitor/issues/5812

Can not create ionic 2 app

I am following the ionic installation guide, but when I want to create app it give me error.
The command I enter is:
ionic start cutePuppyPics --v2
The error it gives is:
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files (x86)\\Nodist\\v\\nodev7.0.0\\node.exe" "C:\\Program Files (x86)\\Nodist\\bin\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! node v7.0.0
npm ERR! npm v3.10.6
npm ERR! code ELIFECYCLE
npm ERR! node-sass#3.9.3 postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass#3.9.3 postinstall script 'node scripts/build.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the node-sass package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node scripts/build.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs node-sass
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls node-sass
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! E:\nodeProjects\ionic\cutePuppyPics\npm-debug.log
Error with start undefined
Error Initializing app: There was an error with the spawned command: npminstall
There was an error with the spawned command: npminstall
Caught exception:
undefined
Mind letting us know? https://github.com/driftyco/ionic-cli/issues
Node v7.0.0 causes this problem. Instead of nodejs v7.0.0 use nodejs v6.9.1 or install LTS version of node from https://nodejs.org/en/download
You don't have to use --v2 when creating your project. Just type
ionic start cutePuppyPics blank
--v2 is not working with latest ionic. you can use
ionic start cutePuppyPics ionic-angular (for ionic 2.x)
ionic start cutePuppyPics ionic1 (ionic 1.x)

Error while trying to install Babel JSX precompiler

Hi am getting the following error while trying to precompile my JSX code. I have been using it but something happened and I am unable to install this
npm install babel-preset-es2015 babel-preset-react
It is showing this error message:
npm ERR! Linux 3.13.0-85-generic npm ERR! argv "/usr/bin/nodejs"
"/usr/bin/npm" "install" "babel-preset-es2015" "babel-preset-react"
npm ERR! node v4.4.5 npm ERR! npm v2.15.5 npm ERR! file
/home/name/.npm/babel-plugin-check-es2015-constants/6.8.0/package/package.json
npm ERR! code EJSONPARSE
npm ERR! Failed to parse json npm ERR! Unexpected token '\u0000' at
1:1374 npm ERR!
e#readme","_id":"is-finite#1.0.1","_from":"is-finite#>=1.0.0 <2.0.0"}
npm ERR!
^ npm ERR! File:
/home/name/.npm/babel-plugin-check-es2015-constants/6.8.0/package/package.json
npm ERR! Failed to parse package.json data. npm ERR! package.json must
be actual JSON, not just JavaScript. npm ERR! npm ERR! This is not a
bug in npm. npm ERR! Tell the package author to fix their package.json
file. JSON.parse
npm ERR! Please include the following file with any support request:
npm ERR! /var/www/html/js/npm-debug.log
How to fix this?
If you want to install globally on your computer those modules, add -g:
npm install -g babel-preset-es2015 babel-preset-react
Otherwise, it meand you want to install it locally. Make sure your have package.json in the root used to launch that command. Follow package rules. Here is an example. Your can try to validate your package.json on package-json-validator.com

Npm install directly from Github Error: ENOENT

I'm running an example from build-nodejs-npm-installation-package-scratch. Instead of uploading to npm repository I'm putting it on Github and trying to download it via npm instead. I run npm install git+https://github.com/t2wu/replaceme.git and got the following:
npm ERR! Error: ENOENT, chmod '/private/tmp/node_modules/replaceme_tim/replaceme.js'
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR! <http://github.com/npm/npm/issues>
npm ERR! System Darwin 13.2.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "git+https://github.com/t2wu/replaceme.git"
npm ERR! cwd /private/tmp
npm ERR! node -v v0.10.28
npm ERR! npm -v 1.4.9
npm ERR! path /private/tmp/node_modules/replaceme_tim/replaceme.js
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /private/tmp/npm-debug.log
npm ERR! not ok code 0
I have a package.json in there, I cannot figure out what is wrong.
EDIT: I can install Express OK, but I can't install my practice module
This happens due to missing permissions or unlinked files while npm was working. This topicc is also seen at github, here.
Try running with admin perms.