Ionic build and emulate on iOS - error

2019-09-19 06:00发布

问题:

I am very happy with everything I've seen so far on the Ionic framework, a child who finds a ball to play, he he.

However, I'm facing some tool configuration problems:

Installed Apache Cordova 6.2.0 on my Mac with Xcode 7.2.1 and Yosemite;

Installed Ionic 1.7.15 client; Node 4.4.5 and NPM 3.9.3;

I managed to create an app, open the Ionic and Ionic Lab View, no problem.

But when I try to install the components to build in xCode, there were some problems:

a) ios-yes - no problem

b) ios-deploy - various error messages:

Npm WARN lifecycle ios-deploy@1.8.6~preinstall: can not run in wd% s% s (% s = wd) ios-deploy@1.8.6 ./src/scripts/check_reqs.js xcodebuild && / usr / local /lib/node_modules/.staging/ios-deploy-298c9491
npm ERR! Darwin 14.5.0
npm ERR! argv "/ usr / local / bin / node" "/ usr / local / bin / npm" "install" "-g" "ios-deploy"
npm ERR! node v4.4.5
npm ERR! npm v3.9.3
npm ERR! path / usr / local / lib / node_modules / ios-deploy / build / Release / ios-deploy
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall chmod

npm ERR! ENOENT ENOENT: no such file or directory chmod '/ usr / local / lib / node_modules / ios-deploy / build / Release / ios-deploy'
npm ERR! ENOENT ENOENT: no such file or directory chmod '/ usr / local / lib / node_modules / ios-deploy / build / Release / ios-deploy'
npm ERR! ENOENT This is Most Likely not a problem with npm itself
npm ERR! ENOENT and is related to npm not being able to find the file.
npm ERR! ENOENT

npm ERR! Please include The Following file with any support request:
npm ERR! /Users/myuser/npm-debug.log

I had problems in the execution of commands:

1) $ ionic platform add ios:

Updated the hooks directory to have execute permissions
Downloading Default Ionic Resources
Downloading: https://github.com/driftyco/ionic-default-resources/archive/master.zip
[=============================] 100% 0.0s
Done adding default Ionic resources
Adding icons for platform: ios
/usr/local/lib/node_modules/cordova/node_modules/configstore/index.js:53
throw err;
^

Error: EACCES: permission denied, open '/Users/myuser/.config/configstore/insight-cordova.json'
You do not have access to this file.

at Error (native)
at Object.fs.openSync (fs.js: 549: 18)
at Object.fs.readFileSync (fs.js: 397: 15)
at Object.create.all.get (/usr/local/lib/node_modules/cordova/node_modules/configstore/index.js:34:26)
at Object.Configstore (/usr/local/lib/node_modules/cordova/node_modules/configstore/index.js:27:44)
at new Insight (/usr/local/lib/node_modules/cordova/node_modules/insight/lib/index.js:38:34)
at Object. <anonymous> (/usr/local/lib/node_modules/cordova/src/telemetry.js:37:15)
at Module._compile (module.js: 409: 26)
at Object.Module._extensions..js (module.js: 416: 10)
at Module.load (module.js: 343: 32) "
I can not compile with the command "$ ionic build ios" using only "$ sudo ionic build ios

Finally, the command "sudo $ ionic emulate ios" opens the simulator but does not show the project ...

I appreciate if anyone has any direction ...

Thanks.

Jan Ferrer

回答1:

Sorry, I am not sure whether this is a comment. I don't have enough points to do so.

Did you install cordova, ionic, etc. with sudo?

This may be happening because of permission problems, and it prevents installing some modules successfully or accessing certain folders in your Mac.

You could do chmod on your folder to change the permission settings, but I don't really recommend that quick fix.

I have also had a similar problem before on Mac, and after hours of trying to get around it, I finally did a fresh install of node using nvm or brew to avoid using sudo again and again when installing modules via npm.

It's a bit of a pain installing fresh, especially since you would need to cleanly remove your current node installation, but it will save you from solving permission errors, using sudo, etc. in the long run.

uninstall/installing node: http://stackabuse.com/how-to-uninstall-node-js-from-mac-osx/

If ever you opt to go through this suggestion, please do update what happens next.



回答2:

Problem solved.

To summarize, I had to uninstall the Apache Cordova, IONIC, had to return to NODE version 6.2.0 to 4.4.5 and 3.8.9 of NPM to 2.15.1; and reinstall again.

I had to give all permission files and folders charged in error messages, using the CHMOD command in OSx terminal.

Hence everything worked satisfactorily.



回答3:

I ran into this problem as well and found a solution in the comments for this question. Your can use

sudo npm install -g ios-deploy --unsafe-perm=true