ionic-team/ionic-cli

Could not install from "node_modules/cordova-plugin-app-event" as it does not contain a package.json file.

Closed this issue ยท 15 comments

jgw96 commented

From @stramanu on June 16, 2017 7:25

Ionic version: (check one with "x")
[ ] 1.x (For Ionic 1.x issues, please use https://github.com/ionic-team/ionic-v1)
[ ] 2.x
[X] 3.x

Node 8
Npm 5

I'm submitting a ... (check one with "x")
[X] bug report
[ ] feature request
[ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or http://ionicworldwide.herokuapp.com/

Current behavior:

After a node_modules directory cleanup, the Cli tells me to install all dependencies but it failes with this error

Expected behavior:

Install all dependencies

Steps to reproduce:
? Looks like a fresh checkout! No ./node_modules directory found. Would you like to install project dependencies? Yes
[INFO] Installing dependencies may take several minutes!

npm install
โœ– Running command - failed!
[ERROR] An error occurred while running npm install (exit code 1):

    npm WARN deprecated object-keys@0.2.0: Please update to the latest object-keys
    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!     /Users/xxxx/.npm/_logs/2017-06-16T07_05_55_089Z-debug.log

Other error

npm install
npm WARN deprecated object-keys@0.2.0: Please update to the latest object-keys
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! /Users/xxxx/.npm/_logs/2017-06-16T07_19_56_538Z-debug.log

Other information: [/Users/xxxx/.npm/_logs/2017-06-16T07_19_56_538Z-debug.log]
1683 verbose stack Error: ENOENT: no such file or directory, open '/Users/xxxx/myproject/node_modules/cordova-plugin-app-event/package.json'
1684 verbose cwd /Users/xxxx/myproject
1685 verbose Darwin 16.5.0
1686 verbose argv "/usr/local/Cellar/node/7.7.3/bin/node" "/usr/local/bin/npm" "install"
1687 verbose node v8.0.0
1688 verbose npm v5.0.0
1689 error code ENOLOCAL
1690 error Could not install from "node_modules/cordova-plugin-app-event" as it does not contain a package.json file.
1691 verbose exit [ 1, true ]

Copied from original issue: ionic-team/ionic-framework#12061

jgw96 commented

From @stramanu on June 16, 2017 7:42

OK now i've removed '"cordova-plugin-app-event": "file:node_modules/cordova-plugin-app-event",' from my package.json, that come from old installation of for 'local-notification', and the modules are installed but with some other errors:

npm WARN deprecated object-keys@0.2.0: Please update to the latest object-keys
npm WARN prefer global node-gyp@3.6.2 should be installed with -g

node-sass@4.5.0 install /Users/xxxx/myproject/node_module/node-sass
node scripts/install.js

Downloading binary from https://github.com/sass/node-sass/releases/download/v4.5.0/darwin-x64-57_binding.node
Cannot download "https://github.com/sass/node-sass/releases/download/v4.5.0/darwin-x64-57_binding.node":

HTTP error 404 Not Found

...

node-sass@4.5.0 postinstall /Users/xxxx/myproject/node_modules/node-sass
node scripts/build.js

Building: /usr/local/Cellar/node/7.7.3/bin/node /Users/xxxx/myproject/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
gyp info it worked if it ends with ok
gyp verb cli [ '/usr/local/Cellar/node/7.7.3/bin/node',
gyp verb cli '/Users/xxxx/myproject/node_modules/node-gyp/bin/node-gyp.js',
gyp verb cli 'rebuild',
gyp verb cli '--verbose',
gyp verb cli '--libsass_ext=',
gyp verb cli '--libsass_cflags=',
gyp verb cli '--libsass_ldflags=',
gyp verb cli '--libsass_library=' ]
gyp info using node-gyp@3.6.2
gyp info using node@8.0.0 | darwin | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb which failed Error: not found: python2
gyp verb which failed at getNotFoundError (/Users/xxxx/myproject/node_modules/which/which.js:13:12)
gyp verb which failed at F (/Users/xxxx/myproject/node_modules/which/which.js:68:19)
gyp verb which failed at E (/Users/xxxx/myproject/node_modules/which/which.js:80:29)
gyp verb which failed at /Users/xxxx/myproject/node_modules/which/which.js:89:16
gyp verb which failed at /Users/xxxx/myproject/node_modules/isexe/index.js:42:5
gyp verb which failed at /Users/xxxx/myproject/node_modules/isexe/mode.js:8:5
gyp verb which failed at FSReqWrap.oncomplete (fs.js:152:21)
gyp verb which failed python2 { Error: not found: python2
gyp verb which failed at getNotFoundError (/Users/xxxx/myproject/node_modules/which/which.js:13:12)
gyp verb which failed at F (/Users/xxxx/myproject/node_modules/which/which.js:68:19)
gyp verb which failed at E (/Users/xxxx/myproject/node_modules/which/which.js:80:29)
gyp verb which failed at /Users/xxxx/myproject/node_modules/which/which.js:89:16
gyp verb which failed at /Users/xxxx/myproject/node_modules/isexe/index.js:42:5
gyp verb which failed at /Users/xxxx/myproject/node_modules/isexe/mode.js:8:5
gyp verb which failed at FSReqWrap.oncomplete (fs.js:152:21) code: 'ENOENT' }

......

gyp info ok
Installed to /Users/xxxx/myproject/node_modules/node-sass/vendor/darwin-x64-57/binding.node
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN ionic-angular@3.4.0 requires a peer of @angular/common@4.1.3 but none was installed.
npm WARN ionic-angular@3.4.0 requires a peer of @angular/compiler@4.1.3 but none was installed.
npm WARN ionic-angular@3.4.0 requires a peer of @angular/compiler-cli@4.1.3 but none was installed.
npm WARN ionic-angular@3.4.0 requires a peer of @angular/core@4.1.3 but none was installed.
npm WARN ionic-angular@3.4.0 requires a peer of @angular/forms@4.1.3 but none was installed.
npm WARN ionic-angular@3.4.0 requires a peer of @angular/http@4.1.3 but none was installed.
npm WARN ionic-angular@3.4.0 requires a peer of @angular/platform-browser@4.1.3 but none was installed.
npm WARN ionic-angular@3.4.0 requires a peer of @angular/platform-browser-dynamic@4.1.3 but none was installed.
npm WARN ionic-angular@3.4.0 requires a peer of rxjs@5.4.0 but none was installed.
npm WARN ionic-angular@3.4.0 requires a peer of zone.js@0.8.12 but none was installed.
npm WARN The package @ionic/cli-plugin-ionic-angular is included as both a dev and production dependency.
npm WARN cordova-ios@4.4.0 had bundled packages that do not match the required version(s). They have been replaced with non-bundled versions.

jgw96 commented

From @danielsogl on June 16, 2017 11:15

Ionic and the ionic-app-scripts are not NPM5 compatible.
Downgrade to Node 6.11 + npm 3 or 4 and wait for the next ionic-app-scripts release.

This should be fixed now with current @ionic/app-scripts versions. Can you confirm @stramanu?

@janpio: it certainly does not work for me...

npm ERR! code ENOLOCAL
npm ERR! Could not install from "node_modules/es6-promise-plugin" as it does not contain a package.json file.

NPM version: 5.0.4

Delete your package-lock.json file
Delete your node_modules directory

run
npm i

It works for me using the following
ionic info

global packages:

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

local packages:

@ionic/app-scripts              : 1.3.12
@ionic/cli-plugin-cordova       : 1.4.0
@ionic/cli-plugin-ionic-angular : 1.3.1
Cordova Platforms               : android 6.2.3 browser 4.1.0
Ionic Framework                 : ionic-angular 3.5.0

System:

Node       : v8.1.3
OS         : Windows 10
Xcode      : not installed
ios-deploy : not installed
ios-sim    : not installed
npm        : 5.0.4

You can't use Cordova plugins that haven't made the necessary changes for Cordova 7.

Go without the plugins you're trying to install or go back to Cordova 6.

I am phases this problem.
can any told me what is solution of this problem.

info it worked if it ends with ok
verbose cli [ 'C:\Program Files\nodejs\node.exe',
verbose cli 'C:\Users\admin\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js',
verbose cli 'install',
verbose cli 'file:node_modules/cordova-plugin-network-information',
verbose cli '--save' ]
info using npm@5.2.0
info using node@v6.9.2
verbose npm-session a6526c7d2633200d
silly install loadCurrentTree
silly install readLocalPackageData
silly fetchPackageMetaData error for file:node_modules\cordova-plugin-network-information Could not install from "node_modules\cordova-plugin-network-information" as it does not contain a package.json file.
verbose stack Error: ENOENT: no such file or directory, open 'C:\Users\admin\schoolDiary\node_modules\node_modules\cordova-plugin-network-information\package.json'
verbose stack at Error (native)
verbose cwd C:\Users\admin\schoolDiary\node_modules
verbose Windows_NT 6.1.7601
verbose argv "C:\Program Files\nodejs\node.exe" "C:\Users\admin\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js" "install" "file:node_modules/cordova-plugin-network-information" "--save"
verbose node v6.9.2
verbose npm v5.2.0
error code ENOLOCAL
error Could not install from "node_modules\cordova-plugin-network-information" as it does not contain a package.json file.
verbose exit [ 1, true ]

@pky858 Did you try any of the solutions explained in this issue?

I did and it didn't help...

@lonormaly Can you check your package.json for weirdness? I've seen Cordova add "node_modules/<plugin>" to the dependencies section. It's very strange, but if you delete the entry, completely remove the Cordova plugin, delete node_modules and package-lock.json, and reinstall everything, it may work again. That's kind of the ritual I and many others do when stuff gets corrupted.

@dwieeb Genius! Thank you so much. Indeed "node_modules/<plugin> was there :)

@dwieeb came here to thank you! This solved it for me.

npm ERR! code ENOLOCAL
npm ERR! Could not install from "" 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\Computer\AppData\Roaming\npm-cache_logs\2017-12-13T08_31_06_693Z-debug.log

hi, getting this error, please help me out, --:
`
$ ionic serve

? Looks like a fresh checkout! No ./node_modules directory found. Would you liky
? Looks like a fresh checkout! No ./node_modules directory found. Would you lik
e to install project dependencies? Yes
Installing dependencies may take several minutes!

npm i
ร— Running command - failed!
[ERROR] An error occurred while running npm i (exit code 1):

    npm ERR! code ENOTFOUND
    npm ERR! errno ENOTFOUND
    npm ERR! network request to http://registry.npmjs.org/@angular%2fcommon                                                   failed, reason: getaddrinfo ENOTFOUND ip ip:80
    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 networ                                                  k settings.
    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\xxxx\AppData\Roaming\npm-cache\_logs\2017-12-21T                                                  09_40_05_140Z-debug.log

`

Hi all, I'm gonna lock this issue to preserve our inboxes.

If you're coming here from Google and your issue is related to this, the best solution we know of is here: #2454 (comment)

If that solution doesn't work or doesn't make sense, please fill out a new issue and complete the issue template. Thanks!