Sentry-react-native: Using node with nvm not working

Created on 28 Sep 2017  ·  6Comments  ·  Source: getsentry/sentry-react-native

OS:

  • [ ] Windows
  • [x] MacOS
  • [ ] Linux

_Platform:_

  • [x] iOS
  • [ ] Android

Output of node -v && npm -v && npm ls --prod --depth=0

v8.4.0
5.3.0
/Users/cstyles
└── (empty)

Config:

Sentry.config('https://[email protected]/...').install()

react-native: 0.48.4
xcode: 9.0

ios/build-phase-scripts/upload-dsym.sh

#!/bin/bash

# Setup nvm and set node
[ -z "$NVM_DIR" ] && export NVM_DIR="$HOME/.nvm"

if [[ -s "$HOME/.nvm/nvm.sh" ]]; then
. "$HOME/.nvm/nvm.sh"
elif [[ -x "$(command -v brew)" && -s "$(brew --prefix nvm)/nvm.sh" ]]; then
. "$(brew --prefix nvm)/nvm.sh"
fi

# Set up the nodenv node version manager if present
if [[ -x "$HOME/.nodenv/bin/nodenv" ]]; then
eval "$("$HOME/.nodenv/bin/nodenv" init -)"
fi

[ -z "$NODE_BINARY" ] && export NODE_BINARY="node"

# Run sentry cli script to upload debug symbols
$NODE_BINARY ../node_modules/sentry-cli-binary/bin/sentry-cli upload-dsym

Bundle React Native code and images

export SENTRY_PROPERTIES=sentry.properties
export NODE_BINARY=node
./build-phase-scripts/upload-dsym.sh

error: env: node: No such file or directory

or NODE_BINARY="/Users/cstyles/.nvm/versions/node/v8.4.0/bin/node" output env: node: No such file or directory

This doc doesn't help me

Most helpful comment

Temporary solution:

n=$(which node);n=${n%/bin/node}; chmod -R 755 $n/bin/*; sudo cp -r $n/{bin,lib,share} /usr/local

All 6 comments

Temporary solution:

n=$(which node);n=${n%/bin/node}; chmod -R 755 $n/bin/*; sudo cp -r $n/{bin,lib,share} /usr/local

I posted a workaround here: https://github.com/getsentry/sentry-cli/issues/421#issuecomment-646809066 , though it would be nice if the sentry script had built-in nvm support like the react-native-xcode script does.

i faced this problem too. Does she have a normal solution? I don't want to change custom scripts
/Users/.../Library/Developer/Xcode/DerivedData/...-fxaxgcxspwfdcjgdpuirupqfpkek/Build/Intermediates.noindex/....build/Debug-iphonesimulator/....build/Script-00DD1BFF1BD5951E006B06BC.sh: line 6: ../node_modules/@sentry/cli/bin/sentry-cli: No such file or directory Command PhaseScriptExecution failed with a nonzero exit code

@valery-lavrik I am not sure what can be done since the sentry script is a node script, hence why I worked around it by adding the node lookup logic.

@valery-lavrik I am not sure what can be done since the sentry script is a node script, hence why I worked around it by adding the node lookup logic.

To be honest, I did not understand in which file you need to write your code. Can you tell me?

@valery-lavrik did you take al look at https://github.com/getsentry/sentry-cli/issues/421#issuecomment-646809066 ?

Ah, did you mean where do you put the code I wrote on that comment? It would replace the content that sentry adds to the build phase.

Was this page helpful?
0 / 5 - 0 ratings