tilemill-project / tilemill

TileMill is a modern map design studio
https://tilemill-project.github.io/tilemill/
BSD 3-Clause "New" or "Revised" License
3.12k stars 527 forks source link

Mac M1 install error #2760

Open pankus opened 2 years ago

pankus commented 2 years ago

related to #2759

If I follow this instruction from Tilemill documentation:

git clone https://github.com/tilemill-project/tilemill.git
cd tilemill
nvm install lts/carbon
nvm use v8.15.0
npm install

with the following result (from log):

5692 verbose node v8.15.0
5693 verbose npm  v6.4.1
5694 error Error while executing:
5694 error /usr/bin/git ls-remote -h -t git://github.com/florianf/bones.git
5694 error
5694 error undefined
5694 error exited with error code: 128
5695 verbose exit [ 1, true ]

end from terminal:

amigo@MBP tilemill % npm install
npm WARN tilemill@1.0.1 No license field.

npm ERR! Error while executing:
npm ERR! /usr/bin/git ls-remote -h -t git://github.com/florianf/bones.git
npm ERR!
npm ERR! undefined
npm ERR! exited with error code: 128

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/amigo/.npm/_logs/2022-09-03T03_46_08_346Z-debug.log

I presume that there is a remote connection problem, thus I tried to launch the simple command: /usr/bin/git ls-remote -h -t git://github.com/florianf/bones.git This is the response: fatal: unable to connect to github.com: github.com[0: 140.82.121.3]: errno=Operation timed out

pankus commented 2 years ago

I guess that the problem could be related to the way github is being accessed. If I replace git:// with https:// in the command git ls-remote -h -t https://github.com/florianf/bones.git a valid response is returned. How can I force npm to access github with the https protocol?

update In order to force an https connection, it is necessary to give the following command: git config --global url."https://".insteadOf git:// After that, the installation procedure works well (this page)

possibly related to #2737

csytsma commented 2 years ago

@pankus Thanks for doing more troubleshooting on this. I have recently acquired an M1 for work, so decided to go through the installation process. I found the following issues and fixes, and was able to complete the installation.

Tips & Hints for Installing on OSX M1:

  1. Need to run iTerm (Terminal or iTerm2) in Rosetta mode. Instructions
  2. If you get an error about npm not being compatible with v8.17.0
    • Uninstall node: nvm uninstall v8.17.0
    • Reinstall node: nvm install v8.17.0
    • Don't re-run script, which will execute nvm install-latest-npm, which will screw things up.
  3. Manually run the git commands from the script to checkout branch, if they didn't run earlier.
  4. Either run pankus' command above to change git default to https, or edit the package-lock.json file that was installed, and replace all git:// occurrences with https://.
  5. Execute npm clean-install

I was able to successfully start up Tilemill and run the sample projects that didn't try to use Postgres (Road Trip won't work). If you want Postgress, then you need to run the ./installdb.sh installation script, but update it to use the arm processor, if running in Rosetta mode. I didn't test running the install in non-Rosetta, since I already changed my iTerm. Possible that if you

  1. Edit the ./tilemill/utils/installdb.sh script:
    • find every brew install ... line, and add arch -arm64 before it. So that each occurrence looks like:
    • arch -arm64 brew install ...

Not sure if the following is due to M1 issues, or just weird/random OSX issues. Got an error that it couldn't run: creating directory /usr/local/var/postgres ... initdb: error: could not create directory "/usr/local/var": Permission denied

My steps to fix:

  1. $ sudo mkdir /usr/local/var
  2. $ sudo chown -Rwhoami/usr/local/var
  3. $ initdb /usr/local/var/postgres -E utf8 ....run the rest of the commands in the script manually.

Project Road Trip now works.

up-n-running commented 1 year ago

I managed to install using the above instructions from csytsma. Thank you!!!

The only step i had to add was to run the following command in my terminal directly after enabling rosetta in step 1 to switch my shell to x86 mode before running nvm

arch -x86_64 zsh

Also, once installed. You can disable rosetta mode from step 1 and you can still run tilemill. You can even run tilemill when node 8 isnt your current node version by using the following command to start the tilemill server inside the tilemill directory:

nvm run 8 .

So my full install / run instructions (adapted from the readme for M1) now become:

****INSTALL****

Need to run iTerm (Terminal or iTerm2) in Rosetta mode. https://github.com/nvm-sh/nvm/issues/2350#issuecomment-740379270

git clone https://github.com/tilemill-project/tilemill.git
cd tilemill
arch -x86_64 zsh
nvm install 8
nvm use 8
npm install

Now you can disable "Run in Rosetta mode". https://github.com/nvm-sh/nvm/issues/2350#issuecomment-740379270

****RUN****

cd tilemill
nvm run 8 .