katzer / cordova-plugin-app-event

Cordova App-Event Plugin
Apache License 2.0
26 stars 23 forks source link

Missing write access #11

Closed Clburguete closed 4 years ago

Clburguete commented 7 years ago

Hi! tried to install several times and follow some workarounds for the cordova-local-notifications, but i cant solve this issue:

cameraApp git:(master) ✗ npm i cordova-plugin-app-event npm WARN checkPermissions Missing write access to /Users/clburguete/Desktop/Booknbloom/inshop-creation/android-camera/cameraApp/node_modules/cordova-plugin-app-event npm ERR! path /Users/clburguete/Desktop/Booknbloom/inshop-creation/android-camera/cameraApp/node_modules/cordova-plugin-app-event npm ERR! code ELOOP npm ERR! errno -62 npm ERR! syscall access npm ERR! ELOOP: too many symbolic links encountered, access '/Users/clburguete/Desktop/Booknbloom/inshop-creation/android-camera/cameraApp/node_modules/cordova-plugin-app-event'

My node is installed through homebrew, and i checked the permissions where correctly configured- I've never encountered this kind of error before. Could anyone tell me what's going on?

Thanks in advance

ghost commented 7 years ago

I'm encountering this error also. Steps how I get his error:

  1. yarn
  2. Cordova platform add ios

After these steps my package.json looks like this: "cordova-plugin-app-event": "file:node_modules/cordova-plugin-app-event"

And ls -al node_modules/ shows this:

lrwxr-xr-x 1 admin staff 24 26 Jun 14:28 cordova-plugin-app-event -> cordova-plugin-app-event

So after adding the platform iOS the module directory is replaced with a symbolic link on itself. I need to rm -rf node_modules/ then fix the package.json and run yarn again to solve it.

Maybe removing the directory and installing it again will fix it for you.

Clburguete commented 7 years ago

Followed your steps, everything seems to be installed correctly. I'm gonna check now everything is working fine, will close this thread if I encounter no errors. Thanks!

ghost commented 7 years ago

You're welcome. But I don't know why it behaves like this. Just for research purposes, can you please post the log of "ionic info" ?

Clburguete commented 7 years ago

There you go! However, just did a build of an extremely simple android app to check notifications and it doesnt seem to work (maybe it's just some code, i'll update later)

global packages:

@ionic/cli-utils : 1.4.0
Cordova CLI      : 7.0.1
Ionic CLI        : 3.4.0

local packages:

@ionic/app-scripts              : 1.3.7
@ionic/cli-plugin-cordova       : 1.4.0
@ionic/cli-plugin-ionic-angular : 1.3.1
Cordova Platforms               : android 6.2.3
Ionic Framework                 : ionic-angular 3.4.2

System:

Node       : v8.0.0
OS         : macOS Sierra
Xcode      : Xcode 8.3.3 Build version 8E3004b
ios-deploy : 1.9.1
ios-sim    : not installed
npm        : 5.0.0
ghost commented 7 years ago

Your packages are quite similar to the versions I use. So maybe some more folks are encountering this problem, too. Maybe someone has a workaround for this bug.

jdgeier commented 7 years ago

I'm encountering this error as well. PS E:\vsprojects\RegisMobile2Test.old> ionic info

global packages:

@ionic/cli-utils : 1.4.0
Cordova CLI      : 7.0.1
Ionic CLI        : 3.4.0

local packages:

@ionic/app-scripts              : https://registry.npmjs.org/@ionic/app-scripts/-/app-scripts-1.3.0.tgz
@ionic/cli-plugin-cordova       : 1.4.0
@ionic/cli-plugin-ionic-angular : 1.3.1
Cordova Platforms               : none
Ionic Framework                 : ionic-angular https://registry.npmjs.org/ionic-angular/-/ionic-angular-3.0.1.tgz

System:

Node       : v7.9.0
OS         : Windows 10
Xcode      : not installed
ios-deploy : not installed
ios-sim    : not installed
npm        : 5.0.4

PS E:\vsprojects\RegisMobile2Test.old> ionic cordova platform add android

cordova platform add android --save ✖ Running command - failed!

    [ERROR] Cordova encountered an error.
    You may get more insight by running the Cordova command above directly.

    [ERROR] An error occurred while running cordova platform add android --save (exit code 1):

    Using cordova-fetch for cordova-android@^6.2.3
    Error: Failed to fetch platform cordova-android@^6.2.3
    Probably this is either a connection problem, or platform spec is incorrect.
    Check your connection and platform name/version/URL.
    Error: cmd: Command failed with exit code 4294963229 Error output:
    npm ERR! path E:\vsprojects\RegisMobile2Test.old\node_modules\cordova-plugin-app-event\package.json
    npm ERR! code ELOOP
    npm ERR! errno -4067
    npm ERR! syscall open
    npm ERR! ELOOP: too many symbolic links encountered, open
    'E:\vsprojects\RegisMobile2Test.old\node_modules\cordova-plugin-app-event\package.json'

    npm ERR! A complete log of this run can be found in:
    npm ERR!     C:\Users\jgeier\AppData\Roaming\npm-cache\_logs\2017-06-27T16_32_34_494Z-debug.log
Clburguete commented 7 years ago

Hi @jdgeier Issues were solved following @ahermle93 's instructions:

-rm -rf node_modules -run npm install OR yarn

solved!

jdgeier commented 7 years ago

I deleted both node_modules and platforms and ran npm install and then ionic cordova platform add android and I still receive the same error.

Clburguete commented 7 years ago

Hmmm, try just removing node_modules, without removing platform and then running npm install. That seemed to work for me, hope it does the same for you. Please keep us updated

ghost commented 7 years ago

@jdgeier mh if the steps above don't help then I'm quite clueless what could help you. The steps I mentioned and @Clburguete solved it so far.

jdgeier commented 7 years ago

The problem doesn't happen when I run npm install. The problem happens when I try to add android platform.

jdgeier commented 7 years ago

`PS E:\vsprojects\RegisMobile2Test.old> cordova platform add android --save Using cordova-fetch for cordova-android@^6.2.3 Error: Failed to fetch platform cordova-android@^6.2.3 Probably this is either a connection problem, or platform spec is incorrect. Check your connection and platform name/version/URL. Error: cmd: Command failed with exit code 4294963229 Error output: npm ERR! path E:\vsprojects\RegisMobile2Test.old\node_modules\cordova-plugin-app-event\package.json npm ERR! code ELOOP npm ERR! errno -4067 npm ERR! syscall open npm ERR! ELOOP: too many symbolic links encountered, open 'E:\vsprojects\RegisMobile2Test.old\node_modules\cordova-plugin-app-event\package.json'

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\jgeier\AppData\Roaming\npm-cache_logs\2017-06-28T15_07_55_775Z-debug.log`

jdgeier commented 7 years ago

I figured out the issue on windows. Apparently you need to run these commands in an admin terminal now.

jdgeier commented 7 years ago

UGH now I'm getting a different error message: PS E:\vsprojects\RegisMobile2Test.old> ionic cordova platform rm android

cordova platform remove android --save ✖ Running command - failed!

[ERROR] Cordova encountered an error. You may get more insight by running the Cordova command above directly.

[ERROR] An error occurred while running cordova platform remove android --save (exit code 1):

    Removing platform android from config.xml file...
    Removing android from cordova.platforms array in package.json
    Error: cmd: Command failed with exit code 1 Error output:
    npm ERR! code ENOLOCAL
    npm ERR! Could not install from "node_modules\cordova-plugin-app-event" as it does not contain a package.json
    file.

    npm ERR! A complete log of this run can be found in:
    npm ERR!     C:\Users\jgeier\AppData\Roaming\npm-cache\_logs\2017-06-28T16_47_41_074Z-debug.log

PS E:\vsprojects\RegisMobile2Test.old> npm install cordova-plugin-app-event npm ERR! code ENOLOCAL npm ERR! Could not install from "node_modules\cordova-plugin-app-event" as it does not contain a package.json file.

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\jgeier\AppData\Roaming\npm-cache_logs\2017-06-28T16_49_55_427Z-debug.log PS E:\vsprojects\RegisMobile2Test.old> npm install katzer/cordova-plugin-app-event npm ERR! code ENOLOCAL npm ERR! Could not install from "node_modules\cordova-plugin-app-event" as it does not contain a package.json file.

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\jgeier\AppData\Roaming\npm-cache_logs\2017-06-28T16_51_11_855Z-debug.log PS E:\vsprojects\RegisMobile2Test.old>

jdgeier commented 7 years ago

Ok I was finally able to fix this. Ionic and cordova are not yet compatible with npm 5. I downgraded to npm@4.6.1 cleared my npm-cache deleted node_module and platforms then ran npm install and finally added the android platform. Everything appears to be working now. Sorry for the trouble.

Clburguete commented 7 years ago

Hey! Where did you see Ionic and cordova are not compativle with npm 5? Just checked my current version and I'm using npm 5.0.0 - it worked for me!

ghost commented 7 years ago

Hey guys sorry for my belated response. So, me and my team mates, we also figured out, that cordova is not compatible with Node > 7.9.0 and npm > 4.2.0 like @jdgeier already mentioned. Downgrading to Node v7.9.0 and npm v4.2.0 fixed our problems. Cheers!

katzer commented 7 years ago

Hi!, with the upcoming version of the local-notification plugin the app-event plugin isn't required anymore.

F1LT3R commented 7 years ago

Downgrading npm/node did not work for me, but uninstall yarn worked.

It is quite possible that you have Yarn is clashing with NPM. I tried removing Yarn, and node_modules and re-installing.

For example, if you are using Brew, you could do the following:

# Uninstall Yarn
brew uninstall yarn
brew update
brew doctor
# Uprade Node & NPM  
brew upgrade node
npm install -g npm@latest

Then in your project directory:

cd my-cordova-project
rm -rf node_modules

Then I found broken links in my package.json for example: package dependancies with no version number that linger from installs that did not complete.

    {
        "name": "helloworld",
        "displayName": "HelloCordova",
        "version": "1.0.0",
        "description": "A sample Apache Cordova application that responds to the deviceready event.",
        "main": "index.js",
        "dependencies": {
            "cordova-android": "^6.2.3",

            // FAILED INSTALL MIGHT CREATE EMPTY VERSION
            "cordova-plugin-app-version": ""
        },
        "cordova": {
            "plugins": {
                "de.appplant.cordova.plugin.local-notification": {},
                "cordova-plugin-app-version": {}
            }
        }
    }

Then l installed everything again with npm:

npm install

Here is my version info:

node --version
v8.1.4
npm --version
5.3.0
cordova --version
7.0.1
kelvindart commented 7 years ago

Hey @ahermle93 - when you say:

I need to rm -rf node_modules/ then fix the package.json and run yarn again to solve it.

What did you do to fix it? 🙂

ghost commented 7 years ago

Hey @kelvindart the full quote should be:

So after adding the platform iOS the module directory is replaced with a symbolic link on itself. I need to rm -rf node_modules/ then fix the package.json and run yarn again to solve it.

I needed to remove the symbolic link and replace it with a real version number.

kelvindart commented 7 years ago

Hey @ahermle93 - perfect, I will give it a try now 🙂 thanks!

hanifmazlan commented 6 years ago

@Clburguete thank you. it work perfectly and solve my problem.