rnmapbox / maps

A Mapbox react native module for creating custom maps
MIT License
2.27k stars 849 forks source link

Error installing MapboxCommon (pod install error) #2569

Closed ricardodolnl closed 1 year ago

ricardodolnl commented 1 year ago

Environment

Steps to reproduce

I wanted to update mapbox but when trying to pod install I get the error shown below. I do have a valid .netrc file with a secret key from mapbox (with downloads:read rights). Also as I mentioned before I was trying to update mapbox, so I did work perfectly before.

/node_modules/@rnmapbox/maps/rnmapbox-maps.podspec:91: warning: already initialized constant Pod::MapboxImplVersion
/node_modules/@rnmapbox/maps/rnmapbox-maps.podspec:91: warning: previous definition of MapboxImplVersion was here Downloading dependencies
Installing MapboxCommon 23.2.1 (was 22.1.0)

[!] Error installing MapboxCommon
[!] /usr/bin/curl -f -L -o /var/folders/zr/c3cpjz893wz6st4jvbl0kd6m0000gn/T/d20230130-88977-1sk48u/file.zip https://api.mapbox.com/downloads/v2/mapbox-common/releases/ios/packages/23.2.1/MapboxCommon.zip --create-dirs --netrc-optional --retry 2 -A 'CocoaPods/1.11.3 cocoapods-downloader/1.6.3'

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0    39    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (22) The requested URL returned error: 401
ricardodolnl commented 1 year ago

I tried to run the curl command itself and noticed that it only works if the "-f" is removed. How can I tell cocoapods to do that while running pod install?

beisert1 commented 1 year ago

We are noticing this as well on fresh install, this started happening around Jan 27th. No changes on our end and was working fine before. You can replicate by deleting your pods folder and podfile.lock and attempting pod install.

Error:

[!] Error installing Mapbox-iOS-SDK
[!] /usr/bin/curl -f -L -o /var/folders/8h/f6p0d41n0nlgcdgrd5p_x9r921rtr1/T/d20230131-46319-xaj16x/file.zip https://api.mapbox.com/downloads/v2/mobile-maps/releases/ios/packages/6.3.0/mapbox-ios-sdk-dynamic.zip --create-dirs --netrc-optional --retry 2 -A 'CocoaPods/1.11.3 cocoapods-downloader/1.5.1'

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (22) The requested URL returned error: 403
beisert1 commented 1 year ago

FWIW we created a new token and pod install is now working again. My error was 403 while yours is 401 so might be unrelated to your issue.

mfazekas commented 1 year ago

Sounds like a mapbox/cocoapod issue, closing it as we don't have the resources ot investigate

hannojg commented 1 year ago

I would say it isn't a cocoa pod issue? When I try to open the URL that is mentioned in the error in the browser https://api.mapbox.com/downloads/v2/mapbox-common/releases/ios/packages/23.2.1/MapboxCommon.zip

I get a 401 - {"message":"Not Authorized - No Token"} error as well

mfazekas commented 1 year ago

@hannojg you'll need the proper tokens to access that, so 401 is expected in browser

hannojg commented 1 year ago

Yes you are right! Sorry for bothering 😅

nanahenniu commented 1 year ago

x

Environment

  • Dev OS: MacOS 13.2
  • React Native: 0.70.6
  • Mapbox: v10.0.0-beta.65 (was beta.33 before)

Steps to reproduce

I wanted to update mapbox but when trying to pod install I get the error shown below. I do have a valid .netrc file with a secret key from mapbox (with downloads:read rights). Also as I mentioned before I was trying to update mapbox, so I did work perfectly before.

/node_modules/@rnmapbox/maps/rnmapbox-maps.podspec:91: warning: already initialized constant Pod::MapboxImplVersion
/node_modules/@rnmapbox/maps/rnmapbox-maps.podspec:91: warning: previous definition of MapboxImplVersion was here Downloading dependencies
Installing MapboxCommon 23.2.1 (was 22.1.0)

[!] Error installing MapboxCommon
[!] /usr/bin/curl -f -L -o /var/folders/zr/c3cpjz893wz6st4jvbl0kd6m0000gn/T/d20230130-88977-1sk48u/file.zip https://api.mapbox.com/downloads/v2/mapbox-common/releases/ios/packages/23.2.1/MapboxCommon.zip --create-dirs --netrc-optional --retry 2 -A 'CocoaPods/1.11.3 cocoapods-downloader/1.6.3'

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0    39    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (22) The requested URL returned error: 401

hi, I meet the same problem, how did you solve it?I read your conversation,but I don't seem to have found a solution~~~help please!

ansarikhurshid786 commented 1 year ago

I got solution: Open terminal Type open .netrc Paste following in .netrc file

machine api.mapbox.com
login mapbox
password <mapbox_tocken>

Save the file and now run pod install

Refer: https://stackoverflow.com/questions/64007478/cocoapods-error-installing-mapbox-ios-sdk

redefinered commented 1 year ago

I got solution: Open terminal Type open .netrc Paste following in .netrc file

machine api.mapbox.com
login mapbox
password <mapbox_tocken>

Save the file and now run pod install

Refer: https://stackoverflow.com/questions/64007478/cocoapods-error-installing-mapbox-ios-sdk

I did this, did not work, the link is non-existent now as well. Is there any more steps you did?

redefinered commented 1 year ago

I take it back. It works. Thanks @ansarikhurshid786 ! Good catch!

UdayVinaik commented 1 year ago

If you have tried with creating .netrc file and still it is not working, please try to put following line in podFile: $RNMapboxMapsVersion = '~> 10.11.1' just after $RNMapboxMapsImpl = 'mapbox' if you are on Mapbox version 10

ovsiannykov commented 1 year ago

If you have tried with creating .netrc file and still it is not working, please try to put following line in podFile: $RNMapboxMapsVersion = '~> 10.11.1' just after $RNMapboxMapsImpl = 'mapbox' if you are on Mapbox version 10

But it didn't help me :(

illlama commented 1 year ago

I struggled same issue and I followed bellow link and then it worked to me. https://dev.to/ajmal_hasan/react-native-mapbox-v10-installation-7ga It seems similar with comments from others ... anyway it helped me so I recommend you to check it

norellanac commented 1 year ago

Make sure that your text editor it´s not adding additional strings.

trying touch ~/.netrc echo "machine api.mapbox.com" > ~/.netrc echo "login mapbox" >> ~/.netrc echo "password <INSERT API TOKEN>" >> ~/.netrc

`touch ~/.netrc

nano ~/.netrc`

alimtunc commented 1 year ago

Nothing worked for me. My fix was to be sure that downloads:read was selected when creating token.

Capture d’écran 2023-08-03 à 23 36 18
shiraz27 commented 1 year ago

It is both what @norellanac said and @alimtunc said.

  1. make sure your token has DOWNLOADS:READ scope
  2. vi ~/.netrc and insert the following lines :

machine api.mapbox.com login mapbox password whatever_token_we_have_in_env_for_mapbox

  1. voilà
DachengChen commented 11 months ago

it works, just use login mapbox, not use your account name, and passoword is your api key and with downloads:read

bataevvlad commented 11 months ago

Be aware also to check if there no additional spaces in password was added, this break all my .netrc thing....

im accomplish with success using this script: open -a TextEdit ~/.netrc

and im found that i have spaces in the password and delete it, and all works well!

when im use: nano ~/.netrc it adding spaces, so be aware

kingahmedino commented 6 months ago

The solution with using .netrc file works. Just make sure that the .netrc file is in your home directory. I was making the mistake of placing the file in my project directory which didn't work for me.

eybel commented 5 months ago

Ok if you are using expo. You just need to put your secret token as a property in the app.json > plugin:

"plugins": [ "expo-router", [ "@rnmapbox/maps", { "RNMapboxMapsDownloadToken": "sk.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RNMapboxMapsVersion": "11.0.0" } ] ]