76976

New to ionic - can’t build for ios (9) on El Capitan, and sudo ionic is required, deprecated npmconf

Question:

I am a student and I just started with ionic today. I have no experience with command line usage so I am pretty stumped here.

When I try to run the basic template (tabs) with:

sudo ionic platform add ios sudo ionic build ios sudo ionic emulate ios

(these don't work without having the sudo there). the last one produces this in the logs (among other stuff above):

** BUILD SUCCEEDED ** No target specified for emulator. Deploying to iPhone-6 simulator An error was encountered processing the command (domain=com.apple.CoreSimulator.SimError, code=159): Invalid device state An error was encountered processing the command (domain=com.apple.CoreSimulator.SimError, code=159): Invalid device state ENOENT: no such file or directory, stat '/Users/Dylan/Library/Logs/CoreSimulator/D0923A6C-7738-41BA-8134-ED747069991A/system.log' Error code 1 for command: ios-sim with args: launch,/Users/Dylan/myApp/platforms/ios/build/emulator/myApp.app,--devicetypeid,com.apple.CoreSimulator.SimDeviceType.iPhone-6,--stderr,/Users/Dylan/myApp/platforms/ios/cordova/console.log,--stdout,/Users/Dylan/myApp/platforms/ios/cordova/console.log,--exit Error: /Users/Dylan/myApp/platforms/ios/cordova/run: Command failed with exit code 2

I have seen a few unsolved posts with the same errors but they haven't gotten anywhere. It could possibly be related to these following things here:

When running sudo npm install -g cordova ionic I get this warning:

npm WARN deprecated npmconf@2.1.2: this package has been reintegrated into npm and is now out of date with respect to npm

Also, afterwards, if I try to run ionic I get a -bash: ionic: command not found error, but if I run sudo ionic then it logs a whole bunch of stuff to the console. Could this one be an error with security changes in El Capitan?

Thanks for your help in advance.

Answer1:

To prevent having to <strong>sudo</strong> almost anything you do in <strong>npm</strong> while working on MAC, my best advice is:

<strong>Install npm through <a href="https://www.npmjs.com/package/nvm" rel="nofollow">Node Version Manager</a></strong>.

Recommend

  • Cannot find my downloaded file in the document folder via fileExistsAtPath
  • Can`t copy file from bundle to documents directory in iOS
  • Document directory path change when rebuild application
  • PHP Copy function not working
  • QPushButton is not changing the background-color proper
  • Sending Content-Type application/x-www-form-urlencoded WSO2 ESB
  • IOS > Open URL in Safari with POST
  • Fat binaries in iOS
  • What does Main.1 output file do in XCode?
  • Timeout a query
  • Python PIL to extract number from image
  • how to populate a SQLite database and use that database in phonegap?
  • Passing variable arguments using PowerShell's Start-Process cmdlet
  • Android cannot disable cut copy paste
  • How to retrieve information from antrun back to maven?
  • netsh acl setting (need alternative method - registry settings?)
  • Hibernate to update table schema
  • Optimizing the print function in Matlab
  • jwtBearer bearer token with rc-1 update to ASP.Net 5
  • UIAlertController button function not working
  • ASP.NET MVC 2 Preview 2 - display directory list rather than home/index
  • SAVE attribute needed for Fortran variables when only the C_LOC address is returned to a C program?
  • Security issues with PHP's Readfile method
  • Sonar maven jacoco code coverage for Multimodule project
  • Stop Bash Script if Hive Fails
  • Should I or shouldn't I use the CachingConnectionFactory with hornetq 2.4.1
  • Email verification using google app script and google forms
  • Cannot resolve symbol 'MyApi'
  • Running a C# exe file
  • Shallow update not allowed (git > 1.9)
  • jquery mobile loadPage not working
  • Akka Routing: Reply's send to router ends up as dead letters
  • Numpy divide by zero. Why?
  • How to include full .NET prerequisite for Wix Burn installer
  • Hits per day in Google Big Query
  • How do you join a server to an Active Directory (domain)?
  • FormattedException instead of throw new Exception(string.Format(…)) in .NET
  • Qt: Run a script BEFORE make
  • Linking SubReports Without LinkChild/LinkMaster
  • XCode 8, some methods disappeared ? ex: layoutAttributesClass() -> AnyClass