Cannot find module '../../package.json'
Hi there
When I try to add some of the required dependancies, while located at the project root, I get an error about problem finding package.json, it seems to be expecting it in the project root but it is not there.
Am I missing something?
...
Fetching plugin "https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin.git" via git clone
Running command: /Users/arnthorsnaer/Documents/PushNotificationSample/hooks/after_plugin_add/010_register_plugin.js /Users/arnthorsnaer/Documents/PushNotificationSample
module.js:340
throw err;
^
Error: Cannot find module '../../package.json'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/Users/arnthorsnaer/Documents/PushNotificationSample/hooks/after_plugin_add/010_register_plugin.js:7:19)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
Error: Hook failed with error code 8: /Users/arnthorsnaer/Documents/PushNotificationSample/hooks/after_plugin_add/010_register_plugin.js
at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:194:23
at _rejected (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:797:24)
at /usr/local/lib/node_modules/cordova/node_modules/q/q.js:823:30
at Promise.when (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:1035:31)
at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:741:41)
at /usr/local/lib/node_modules/cordova/node_modules/q/q.js:557:44
at flush (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:108:17)
at process._tickCallback (node.js:415:13)
A simple workaround is to create a package.json file in the project root. I'll keep this issue open since you'll probably want to drop in a basic package.json file into this project or edit the README.
I've had the same problem, @hollyschinsky is the package.json a file you use for personal development that didn't make it into the repo?
Hi guys, I used Ionic to create the basic project which contains a package.json file by default. Are you using Ionic as well?
At least I am. In this instance I did not start with an standard Ionic project though, I started with your sample project. You excluded the package.json when pushing to this repo?
Oh ok, yes, I should have clarified that. I usually recommend creating a starter project with Ionic and then replace the www folder with mine from here.
ionic start myPushApp blank
Then add the dependencies... Then it's not limited to versions of things. Does that make sense?
Yes, makes sense. Thanks :)
Makes sense - I would recommend adding this to the README :)
sudo npm install -g [email protected] use this version of ionic will solve this issue