3
votes

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

4
Hi! Please add some more information to your question. For example some code and a description of the expected behavior would make sense. - Jakob Runge
@JakobRunge: This is a perfectly valid question, with the entire stack trace of the error. No code is involved, since it is a GUI utility. (No reason for it to be down voted too) - Sam
Didn't vote down, just commented. I understand my mistake now, thanks for informing me. - Jakob Runge
Cool, thx @JakobRunge :). - Sam

4 Answers

7
votes
cd /Applications/Appium.app/Contents/Resources/node_modules/appium
npm install
1
votes

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.

1
votes

I met the same issue, got the answer here: https://github.com/appium/appium-dot-app/issues/512. Go to /Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules, and change the link files destination to '/usr/local/lib/node_modules/appium/node_modules/xxxx'

0
votes

Got the exact error after upgrading from 1.4.8 to 1.4.13. Removed 1.4.13 and reinstalled 1.4.8 and up and running again.

Got it working by copying the missing node libs from 1.4.8 /Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules and pasting to the same folder for 1.4.13.

Maybe the build for 1.4.13 failed to package this correctly.