Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

appium failed to start - uncaught error instruments

When starting Appium GUI tool, after reinstalling my entire mac I had the following error:

/Applications/Appium.app/Contents/Resources/node/bin/node' '/Applications/Appium.app/Contents/Resources/node_modules/appium/bin/appium.js'

error: uncaughtException: Cannot find module 'appium-instruments' date=Mon Oct 12 2015 14:14:28 GMT+0300 (EEST), pid=444, uid=1525045707, gid=1275180346, cwd=/Applications/Appium.app/Contents/Resources/node_modules/appium, execPath=/Applications/Appium.app/Contents/Resources/node/bin/node, version=v0.12.7, argv=[/Applications/Appium.app/Contents/Resources/node/bin/node, /Applications/Appium.app/Contents/Resources/node_modules/appium/bin/appium.js], rss=80273408, heapTotal=62810368, heapUsed=41559528, loadavg=[2.0048828125, 1.69775390625, 0.82421875], uptime=279, trace=[column=15, file=module.js, function=Function.Module._resolveFilename, line=336, method=Module._resolveFilename, native=false, column=25, file=module.js, function=Function.Module._load, line=278, method=Module._load, native=false, column=17, file=module.js, function=Module.require, line=365, method=require, native=false, column=17, file=module.js, function=require, line=384, method=null, native=false, column=14, file=/Applications/Appium.app/Contents/Resources/node_modules/appium/lib/devices/ios/instruments.js, function=, line=4, method=null, native=false, column=26, file=module.js, function=Module._compile, line=460, method=_compile, native=false, column=10, file=module.js, function=Object.Module._extensions..js, line=478, method=Module._extensions..js, native=false, column=32, file=module.js, function=Module.load, line=355, method=load, native=false, column=12, file=module.js, function=Function.Module._load, line=310, method=Module._load, native=false, column=17, file=module.js, function=Module.require, line=365, method=require, native=false, column=17, file=module.js, function=require, line=384, method=null, native=false, column=19, file=/Applications/Appium.app/Contents/Resources/node_modules/appium/lib/devices/ios/ios.js, function=, line=15, method=null, native=false, column=26, file=module.js, function=Module._compile, line=460, method=_compile, native=false, column=10, file=module.js, function=Object.Module._extensions..js, line=478, method=Module._extensions..js, native=false, column=32, file=module.js, function=Module.load, line=355, method=load, native=false, column=12, file=module.js, function=Function.Module._load, line=310, method=Module._load, native=false], stack=[Error: Cannot find module 'appium-instruments', at Function.Module._resolveFilename (module.js:336:15), at Function.Module._load (module.js:278:25), at Module.require (module.js:365:17), at require (module.js:384:17), at Object. (/Applications/Appium.app/Contents/Resources/node_modules/appium/lib/devices/ios/instruments.js:4:14), at Module._compile (module.js:460:26), at Object.Module._extensions..js (module.js:478:10), at Module.load (module.js:355:32), at Function.Module._load (module.js:310:12), at Module.require (module.js:365:17), at require (module.js:384:17), at Object. (/Applications/Appium.app/Contents/Resources/node_modules/appium/lib/devices/ios/ios.js:15:19), at Module._compile (module.js:460:26), at Object.Module._extensions..js (module.js:478:10), at Module.load (module.js:355:32), at Function.Module._load (module.js:310:12)]

If you have encountered this and know a solution to resolve the error, please let me know

like image 251
Gabriel Stanica Avatar asked Dec 06 '25 01:12

Gabriel Stanica


2 Answers

cd /Applications/Appium.app/Contents/Resources/node_modules/appium
npm install
like image 138
moiz virani Avatar answered Dec 08 '25 14:12

moiz virani


I faced the same problem today. My configuration is Appium 1.4.13 and Xcode Version 7.0.1 (7A1001).

In this link https://github.com/appium/appium-dot-app/issues/510 the solution proposed seems "cleaner" than adding modules from an older version.

It is suggested to change the destination of all the symlinks contained in Appium.app/Contents/Resources/node_modules/appium/node_modules to point to the modules contained in the relative ../submodules folder.

I used command lines like the following ones in order to modify all the symlinks there :

cd /Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules
ln -f -s ../submodules/appium-instruments/ appium-instruments

But it wasn't totally fixed then, I had the same issue as @Igal :

dyld: could not load inserted library '/Applications/Appium.app/Contents/Resources/node_modules/appium/submodules/appium-instruments/thirdparty/iwd7/InstrumentsShim.dylib' because no suitable image found. Did find:
/Applications/Appium.app/Contents/Resources/node_modules/appium/submodules/appium-instruments/thirdparty/iwd7/InstrumentsShim.dylib: mmap() error 1 at address=0x104497000, size=0x00001000 segment=__TEXT in Segment::map() mapping /Applications/Appium.app/Contents/Resources/node_modules/appium/submodules/appium-instruments/thirdparty/iwd7/InstrumentsShim.dylib

I fixed it with the solution proposed here : https://github.com/appium/appium/issues/5720 I.e. by using the following flag when launching Appium from coommand line :

--native-instruments-lib 

In the GUI you can add it too : Developer Settings > Custom Server Flag.

like image 36
Romano Avatar answered Dec 08 '25 14:12

Romano