ngCordova bower error - any ideas how to fix? - angularjs

I've tried to make sure I'm using the latest version as my ngCordova media plugin isn't working for some reason.
I get this error:
npm WARN locking Error: EACCES, open '/Users/SubjectiveEffect/.npm/_locks/bower-e8debc5417026b57.lock'
npm WARN locking at Error (native)
npm WARN locking /Users/SubjectiveEffect/.npm/_locks/bower-e8debc5417026b57.lock failed { [Error: EACCES, open '/Users/SubjectiveEffect/.npm/_locks/bower-e8debc5417026b57.lock']
npm WARN locking errno: -13,
npm WARN locking code: 'EACCES',
npm WARN locking path: '/Users/SubjectiveEffect/.npm/_locks/bower-e8debc5417026b57.lock' }
npm ERR! Darwin 14.5.0
npm ERR! argv "node" "/usr/local/bin/npm" "install" "-g" "bower"
npm ERR! node v0.12.7
npm ERR! npm v2.11.3
npm ERR! Attempt to unlock /usr/local/lib/node_modules/bower, which hasn't been locked
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm ERR! Please include the following file with any support request:
npm ERR! /Users/SubjectiveEffect/myApp/npm-debug.log
I've no idea how to fix this.
Anyone any ideas?
Edit: I did some tidying up, uninstalled and reinstalled. I'm now getting this error when I try "bower install ngCordova"
"bower cached git://github.com/driftyco/ng-cordova.git#0.1.12-alpha
bower validate 0.1.12-alpha against git://github.com/driftyco/ng-cordova.git#*
bower ECMDERR Failed to execute "git ls-remote --tags --heads git://github.com/driftyco/ng-cordova.git", exit code of #69 Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.
Additional error details:
Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo."
But if I try to run it with sudo I get told:
"bower ESUDO Cannot be run with sudo
Additional error details:
Since bower is a user command, there is no need to execute it with superuser permissions.
If you're having permission errors when using bower without sudo, please spend a few minutes learning more about how your system should work and make any necessary repairs."
Any ideas?

The error is stating problems accepting Xcode/iOS license agreement which is a dependency of cordova (to get iOS emulation working).
I guess that Xcode has already been installed by npm/bower, you just need to open it for the first time (Cmd-Space, then type Xcode) to accept the license agreement, then rerun bower install ngCordova.
If Xcode is not yet installed, it is probably less of a hassle to install it manually (see here for details), open it once and rerun bower install ngCordova.
BTW, ilj is right, it is usually a bad practice to run npm or bower under sudo. This leads to all sorts of worm cans.

bower complains that you're running it as root, which is usually a bad practice. you need to run it as "bower --allow-root".

I experienced the same issue with Ionic. The reason was that xCode was updated to a newer version, and I hadn't accepted the terms or launched it after the update.
Just open xCode and try again.

Related

sysmlink error when installing tensorflow/tfjs-node

I'm trying to install #tensorflow/tfjs-node#3.2.1 (latest).
I have follow a lot of other questions I saw regarding such problems but haven't found an answer for this specific issue.
I have installed visual studio with the requested build tools.
node 14.15.5
Tried with and without the flag.
This is the output of the install command:
$ npm install #tensorflow/tfjs-node --build-from-source
npm WARN deprecated node-pre-gyp#0.14.0: Please upgrade to #mapbox/node-pre-gyp: the non-scoped node-pre-gyp package is deprecated and only the #mapbox scoped package will recieve updates in the future
> #tensorflow/tfjs-node#3.2.0 install C:\Users\dark_\Desktop\projects\tfjs2\node_modules\#tensorflow\tfjs-node
> node scripts/install.js
CPU-windows-3.2.0.zip
* Downloading libtensorflow
* Building TensorFlow Node.js bindings
symlink ./lib/napi-v7 failed: null
npm WARN tfjs2#1.0.0 No description
npm WARN tfjs2#1.0.0 No repository field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! #tensorflow/tfjs-node#3.2.0 install: `node scripts/install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the #tensorflow/tfjs-node#3.2.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\dark_\AppData\Roaming\npm-cache\_logs\2021-02-27T18_14_41_492Z-debug.log
After spening a day trying the usual suspects (node-gyp reinstall as global, windows building tools (re)install as global, parameter settings, etc) I've debugged the install script and found an error in it: after the symlink stuff, the author didn't check the "error" variable, and went straight to process.exit(1)
After I tore out my hair, I've found that the solution is on it's way:
https://github.com/tensorflow/tfjs/commit/2e745c8b6efe5ffc396a86cfc50347e629091248
It has been commited to the main branch (2021.02.26), so probably we'll see it in v3.3.0, or v3.2.x
Now the problem is, that if you just do a simple npm install #tensorflow\tfjs-node, the installer sees it as an error, and deletes the whole downloaded directory in node_modules. You COULD prevent the whole thing by:
EXECUTING npm install #tensorflow/tfjs-node --ignore-scripts
THEN correcting the error by hand in the install script (check the commit at the above link) and
RUNNING npm rebuild #tensorflow/tfjs-node --build-from-source.
I needed to restart VSCode, because it had difficulties picking up the references. But if you don't want to mess arround, go back to the v2.x branch for the time being.

An error occurred while running subprocess npm. ionic start

I try to start a new ionic project. I did those steps
1.npm install -g #ionic/cli
2.ionic start
and I got those errors related to npm. I searched but could not find a solution.
npm WARN deprecated request#2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN registry Unexpected warning for https://registry.npmjs.org/: Miscellaneous Warning EINTEGRITY: sha512-F4TxbIf2Zho1u0gkwk7pMZkuAOcjie2Ifj9Txahek0JAUamP58o+0YUlXp2xApo68CRZSFS4nMA5h897G2Q93A== integrity checksum failed when using sha512: wanted sha512-F4TxbIf2Zho1u0gkwk7pMZkuAOcjie2Ifj9Txahek0JAUamP58o+0YUlXp2xApo68CRZSFS4nMA5h897G2Q93A== but got sha512-T7rpJR5srgZoHOMh8Kv1DDE6mbnW43SNUk9aRhPXGCfF2iJZoTEItjVYHC/gvtncRQCksb8Tk6f72HLaB6la0A==. (50573 bytes)
npm WARN registry Using stale data from https://registry.npmjs.org/ due to a request error during revalidation.
npm WARN deprecated core-js#2.6.11: core-js#<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js#3.
npm ERR! cb() never called!
npm ERR! This is an error with npm itself. Please report this error at:
npm ERR! https://npm.community
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Admin\AppData\Roaming\npm-cache_logs\2020-05-05T06_02_58_568Z-debug.log
[ERROR] An error occurred while running subprocess npm.
Delete package-lock.json file from your project, if it is created.
Check your npm version using
npm -v
If your npm version is 5 and above. Then run the following command:
npm cache verify
Then run your install command
npm install -g #ionic/cli
In case you are having the same issue.
I found a solution for this. Go to your terminal and run
npm cache clean --force or remove npm-cache folder manually from C:\Users\Admin\AppData\Roaming
And then run ionic start again

angular-cli globally installation failure

I am trying to install angular-cli globally but getting these errors.What to do?
C:\Users\Jahidul>npm install -g angular-cli
npm WARN registry Using stale data from http://registry.npmjs.org/ because the h
ost is inaccessible -- are you offline?
npm WARN deprecated angular-cli#1.0.0-beta.28.3: angular-cli has been renamed to
#angular/cli. Please update your dependencies.
npm WARN deprecated minimatch#2.0.10: Please update to minimatch 3.0.2 or higher
to avoid a RegExp DoS issue
npm ERR! code ENOTFOUND
npm ERR! errno ENOTFOUND
npm ERR! network request to http://registry.npmjs.org/micromatch failed, reason:
getaddrinfo ENOTFOUND registry.npmjs.org registry.npmjs.org:8080
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settin
gs.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Jahidul\AppData\Roaming\npm-cache\_logs\2017-06-30T14_57_5
6_218Z-debug.log
If you follow the instructions mentioned on this site, you will find out that the command
npm install -g angular-cli
should be replaced by
npm install -g #angular/cli
which is also mentioned in the error. Retry using the new command.
The problem was my internet connection was not stable.Now everything is ok.
If you get the same error and you are behind a corporate network, then you need to change the config to add proxy as below:
Go to node.js install location in command prompt and type below command:
npm config edit --g
Add below lines at the end of the file:
registry=http://registry.npmjs.org/
strict-ssl=false
proxy=http://proxy.YOURCOMPANYNAME.com:8080
Then execute the npm install command:
npm install -g #angular/cli#latest

npm won't create a symlink for webdriver-manager while using JHipster DevBox

I'm trying to use JHipster with the DevBox at work, so with a proxy.
I think I have everything configured accordingly, but I still can't use JHipster properly.
I want to generate a microservice gateway with Protractor, but when I use yo jhipster or npm install, it gives me the following error:
> example-gateway#0.0.0 postinstall /home/vagrant/workspace/example/example-gateway
> webdriver-manager update
sh: 1: webdriver-manager: not found
npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents#1.0.12
npm ERR! Linux 3.13.0-88-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! node v4.4.5
npm ERR! npm v3.9.6
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! example-gateway#0.0.0 postinstall: `webdriver-manager update`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the example-gateway#0.0.0 postinstall script 'webdriver-manager update'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the example-gateway package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! webdriver-manager update
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs example-gateway
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls example-gateway
npm ERR! There is likely additional logging output above.
And with sudo:
npm WARN lifecycle example-gateway#0.0.0~postinstall: cannot run in wd %s %s (wd=%s) example-gateway#0.0.0 webdriver-manager update /home/vagrant/workspace/example/example-gateway
However, I found webdriver-manager in the node_modules/protractor/bin directory, but npm seems to be unable to use it.
Actually, I already succeeded once in generating a microservice gateway with Protractor, but I don't know how: the error about webdriver-manager just disappeared one day. Indeed, there was several other errors (packages that didn't want to be installed), and running npm install over and over again while sometimes installing manually some packages seemed to fix them. However I'm trying to use JHipster on another computer so I need to know how to fix the webdriver-manager error.
I took a look in the node_modules folder of the completed gateway project, and discovered a webdriver-manager symlink inside .bin that wasn't in the same directory of the incomplete gateway project, so I supposed npm used it instead of the one in the node_modules/protractor/bin directory. I created one linking the two in the node_modules/.bin directory of the incomplete gateway project with ln -s ../protractor/bin/webdriver-manager webdriver-manager, and it apparently worked.
The problem is that I'm trying to make the installation and the configuration of the JHipster DevBox somehow automated, so people at work wanting to use it don't have to do it manually. If they have to remember to create a symlink each time they encounter that error, it won't be very practical.
Do you know why npm won't create that symlink himself (or sometime fails to install some packages), and how to fix it in a "clean" way?
Ok I found a solution, but I still don't know exactly why it does this and if their is a cleaner way to fix it.
http://perrymitchell.net/article/npm-symlinks-through-vagrant-windows/
I just replaced the node_modules directory by a symlink to somewhere inside the guest machine, so not in the shared folder with Windows. That way, I skip all the problems caused by Windows. The downside is I have to create the link before generating any project, and to fix that link and download again all the dependencies each time I update the DevBox, because I need to destroy the DevBox to update it.

Error when trying to make an angular application with yeoman in terminal

I'm getting errors when I type this in my terminal
yo angular
First yeoman asks me if I want to use Sass, I answered no.
Then he asked if I want to use bootstrap, answered Yes.
Then he says that there are conflicts between files and he asks if I want to overwrite these files, I answered Yes. And then I'm getting this:
I'm all done. Running bower install & npm install for you to install the required dependencies. If this fails, try running the command yourself.
invoke angular:route
invoke angular:controller:/usr/local/lib/node_modules/generator-angular/route/index.js
identical app/scripts/controllers/about.js
identical test/spec/controllers/about.js
invoke angular:view:/usr/local/lib/node_modules/generator-angular/route/index.js
identical app/views/about.html
conflict test/karma.conf.js
? Overwrite test/karma.conf.js? (Ynaxdh) npm WARN package.json charlotteerpels#0.0.0 No description
npm WARN package.json charlotteerpels#0.0.0 No repository field.
npm WARN package.json charlotteerpels#0.0.0 No README data
npm WARN package.json karma-phantomjs-launcher#0.1.4 No README data
npm WARN prefer global jshint#2.5.11 should be installed with -g
npm ERR! Darwin 14.0.0
npm ERR! argv "node" "/usr/local/bin/npm" "install"
npm ERR! node v0.10.34
npm ERR! npm v2.1.17
npm ERR! path /Users/charlotteerpels/node_modules/.bin/jshint
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! Error: EACCES, unlink '/Users/charlotteerpels/node_modules/.bin/jshint'
npm ERR! { [Error: EACCES, unlink '/Users/charlotteerpels/node_modules/.bin/jshint']
npm ERR! errno: 3,
npm ERR! code: 'EACCES',
npm ERR! path: '/Users/charlotteerpels/node_modules/.bin/jshint' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/charlotteerpels/npm-debug.log
/usr/local/lib/node_modules/generator-angular/node_modules/wiredep/lib/detect-dependencies.js:89
if ($._.isString(componentConfigFile.main)) {
^
TypeError: Cannot read property 'main' of undefined
at findMainFiles (/usr/local/lib/node_modules/generator-angular/node_modules/wiredep/lib/detect-dependencies.js:89:39)
at /usr/local/lib/node_modules/generator-angular/node_modules/wiredep/lib/detect-dependencies.js:151:17
at forOwn (/usr/local/lib/node_modules/generator-angular/node_modules/wiredep/node_modules/lodash/dist/lodash.js:2105:15)
at Function.forEach (/usr/local/lib/node_modules/generator-angular/node_modules/wiredep/node_modules/lodash/dist/lodash.js:3302:9)
at detectDependencies (/usr/local/lib/node_modules/generator-angular/node_modules/wiredep/lib/detect-dependencies.js:33:7)
at wiredep (/usr/local/lib/node_modules/generator-angular/node_modules/wiredep/wiredep.js:65:39)
at Generator._injectDependencies (/usr/local/lib/node_modules/generator-angular/app/index.js:352:5)
at /usr/local/lib/node_modules/generator-angular/node_modules/yeoman-generator/node_modules/async/lib/async.js:232:13
at /usr/local/lib/node_modules/generator-angular/node_modules/yeoman-generator/node_modules/async/lib/async.js:113:21
at /usr/local/lib/node_modules/generator-angular/node_modules/yeoman-generator/node_modules/async/lib/async.js:24:16
MBPvanCharlotte:ang-news charlotteerpels$ [?] May bower anonymously report usage statistics to improve the tool over time? (Y/n) y
events.js:72
throw er; // Unhandled 'error' event
^
Error: read EIO
at errnoException (net.js:905:11)
at TTY.onread (net.js:559:19)
-bash: y: command not found
Does anyone has an idea how to fix this?
Thanks in advance!
Looks like a permissions issue. Are you the admin?
Try running with sudo:
sudo yo angular
Long-term you might want to try and see if changing ownership of your node_modules directory fixes the issue:
sudo chown -R `whoami` ~/node_modules
Link to similar permission issue with NPM
Changing the directory permissions on the bower directory in charlotteerpels/.chmod for all users to read and write, fixed it. My app was made in the wrong directory (my home directory), but there are solutions for that.
make sure you run
bower install
at least once. Bower asks a questions about reporting usage statistics the first time you run it and that will cause
yo angular
command to fail.

Resources