Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Appium install returns a non-zero exit code with NPM7 #14901

Closed
imbeyondboredom opened this issue Nov 21, 2020 · 6 comments · Fixed by #14946
Closed

Appium install returns a non-zero exit code with NPM7 #14901

imbeyondboredom opened this issue Nov 21, 2020 · 6 comments · Fixed by #14946
Labels
Bug a problem that needs fixing Node Node.js-specific issue

Comments

@imbeyondboredom
Copy link

The problem

Appium fails to install or at least returns a non-zero exit code while installing

Environment

  • Appium version (or git revision) that exhibits the issue: 1.19.0
  • Last Appium version that did not exhibit the issue (if applicable): Unsure - maybe 1.11.0
  • Desktop OS/version used to run Appium: OSX
  • Node.js version (unless using Appium.app|exe): v15.2.1
  • Npm or Yarn package manager: npm@7.0.10
  • Mobile platform/version under test: N/A
  • Real device or emulator/simulator: N/A
  • Appium CLI or Appium.app|exe: CLI

Details

When running the following commands on a fresh OS Catalina install:

brew install node
npm install -g appium

it errors with

npm ERR! code ENOENT
npm ERR! syscall chmod
npm ERR! path /usr/local/lib/node_modules/appium/node_modules/.bin/authorize-ios
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, chmod '/usr/local/lib/node_modules/appium/node_modules/.bin/authorize-ios'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 

However - if I go to run appium it does appear to launch. We're installing appium through Packer so the fact that it errors but is still installed is not ideal. I'm also not 100% convinced the install is complete because of this error but I can't be sure.

Someone else saw this same behavior here

Other notable things:

  • Since we're doing this with packer I can say that the OS is new and the test is repeatable
  • I tried downgrading node but that does not seem to have an effect until v1.11.0. It also doesn't seem like I can update it to the latest
@KazuCocoa
Copy link
Member

I was able to install the authorize-ios with appium 1.19.0 on my local via npm install -g. I guess npm failed to create the file in the installation process because of write permission.

@mykola-mokhnach mykola-mokhnach added NotABug ThirdParty upstream problems labels Nov 21, 2020
@mykola-mokhnach
Copy link
Collaborator

Closed as not an issue

@imbeyondboredom
Copy link
Author

I agree with closing this issue as it does appear to be NPM but wanted to post back here in case someone else stumbles across this problem.

This is fixed by installing the latest version of npm or 6.14.9

npm i -g npm@latest
npm install -g appium

@chrmoritz
Copy link

This issue is indeed about appium being unable to be installed with any npm@7 version and the only workaround for it is to downgrade to npm@6 (with npm i -g npm@latest).

It is caused by the unsupported way appium tries to create a bin symlink to authorize-ios in:

"authorize-ios": "./node_modules/.bin/authorize-ios"

In npm@6 all dependencies were installed first before trying to create bin symlinks, but npm@7 changed the installation order and now tries to create the bin symlinks before installing any dependencies. This still works fine if you only use the bin field in the supported way to refer to local files only. But since appium here refers to a file in the ./node_modules dependencies, which just doesn't exist yet, the creating of the symlink will fail and error out the installation.

A possible fix would be to just point the authorize-ios bin field to a local script, which just reexecutes authorize-ios inside ./node_modules/.bin.

@mykola-mokhnach mykola-mokhnach added Bug a problem that needs fixing Node Node.js-specific issue and removed NotABug ThirdParty upstream problems labels Dec 12, 2020
@mykola-mokhnach mykola-mokhnach changed the title Appium install returns a non-zero exit code on OSX. Possibly fails Appium install returns a non-zero exit code on OSX with NPM7 Dec 12, 2020
@mykola-mokhnach mykola-mokhnach changed the title Appium install returns a non-zero exit code on OSX with NPM7 Appium install returns a non-zero exit code with NPM7 Dec 12, 2020
@davidshq
Copy link

davidshq commented Feb 14, 2021

FYI: npm i -g npm@latest now installs npm 7. To get npm 6 an individual will need to do npm i -g npm@6.

I can verify that downgrading to npm 6 allows appium to install successfully.

@chrmoritz
Copy link

This should be fixed for npm 7 starting with appium v1.20.0+ too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug a problem that needs fixing Node Node.js-specific issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants