sentry-expo error during publish

  1. SDK Version: 40.0.0, Nodejs Version: 14.2.0
  2. Platforms(Android/iOS/web/all): all
    sentry-expo: 3.0.5

I followed the directions here Use Sentry - Expo Documentation, and i get the following error when publishing:

Error uploading sourcemaps to Sentry: spawn [HOME_DIR]/[APP_DIR]/node_modules/@sentry/cli/sentry-cli ENOENT

Here is my postPublish section in app.json:

“hooks”: {
“postPublish”: [
{
“file”: “sentry-expo/upload-sourcemaps”,
“config”: {
“organization”: “organization-slug”,
“project”: “project-name”,
“authToken”: “auth-token-with-all-permissions”
}
}
]
}

Here’s what I added to App.js:

Sentry.init({
dsn: ‘https://[DSN].ingest.sentry.io/[ID]’,
enableInExpoDevelopment: true,
debug: true
});

Why am i getting this error? how do i configure sentry to work with a managed expo 40.0.0 app?

Hi

ENOENT basically means “no such file or directory”. So it looks like it can’t find the sentry-cli. Do you have a file or symlink called sentry-cli at the location given in the error?

If I run yarn add sentry-expo in a new project I can find these files/symlinks afterwards:
(Note: I use yarn. If you use npm you should use npm i sentry-expo instead.)

$ find node_modules -name 'sentry-cli'
node_modules/.bin/sentry-cli
node_modules/@sentry/wizard/node_modules/.bin/sentry-cli
node_modules/@sentry/cli/bin/sentry-cli
node_modules/@sentry/cli/sentry-cli

and the last one of those looks like it matches your error message.

So make sure you have sentry-expo installed and if you’re still getting that error, clear out your node_modules and rerun npm install or yarn.

2 Likes

Brilliant! clearing out node_modules and re-running yarn did it. I didn’t have that last file in your list even though i’d installed sentry-expo. I wonder why that happened. Thanks!

1 Like

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.