Cannot find module './project'


#1

Running ionic@2.0.0-beta.25 and from the CLI using the command

ionic share user@domain.tld

This throws an error in the CLI in ionc/lib/ionic/share.js


Error: Cannot find module './project'
    at Function.Module._resolveFilename (module.js:339:15)
    at Function.Module._load (module.js:290:25)
    at Module.require (module.js:367:17)
    at require (internal/module.js:16:19)
    at Object.<anonymous> (C:\Users\Joe\AppData\Roaming\npm\node_modules\ionic\lib\ionic\share.js:7:20)
    at Module._compile (module.js:413:34)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Module.require (module.js:367:17)


Cannot find module './project' (CLI v2.0.0-beta.25)

Tried to then run npm install project, but error still occurs. Can’t seem to find a module named project inside the ionic package.

My system information:

Your system information:

Cordova CLI: 6.0.0
Ionic Framework Version: 2.0.0-beta.6
Ionic CLI Version: 2.0.0-beta.25
Ionic App Lib Version: 2.0.0-beta.15
OS: Windows 7 SP1
Node Version: v5.7.0

#2

I am having the same issue after trying to build for iOS and Android. Here is my system info:

Your system information:

Cordova CLI: 6.0.0
Ionic Framework Version: 1.2.4
Ionic CLI Version: 2.0.0-beta.25
Ionic App Lib Version: 2.0.0-beta.15
ios-deploy version: Not installed
ios-sim version: 5.0.6 
OS: Mac OS X El Capitan
Node Version: v5.5.0
Xcode version: Xcode 6.3.1 Build version 6D1002

#3

+1 same problem when running ionic share

Error: Cannot find module './project'
    at Function.Module._resolveFilename (module.js:339:15)
    at Function.Module._load (module.js:290:25)
    at Module.require (module.js:367:17)
    at require (internal/module.js:16:19)
    at Object.<anonymous> (C:\Users\Alexander\AppData\Roaming\npm\node_modules\ionic\lib\ionic\share.js:7:20)
    at Module._compile (module.js:413:34)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Module.require (module.js:367:17)


Cannot find module './project' (CLI v2.0.0-beta.25)

Your system information:

Cordova CLI: 6.0.0
Gulp version:  CLI version 3.9.1
Gulp local:   Local version 3.9.1
Ionic Framework Version: 2.0.0-beta.6
Ionic CLI Version: 2.0.0-beta.25
Ionic App Lib Version: 2.0.0-beta.15
OS:
Node Version: v5.7.0

My OS is WIndows 10 x64, I dont know why it doesnt show in the command line output


#4

It’s a bug, I created a new issue about it:

As a temporary workaround you could update node_modules\ionic\lib\ionic\share.js:

var path = require('path'),
    parseUrl = require('url').parse,
    shelljs = require('shelljs/global'),
    argv = require('optimist').boolean(['no-cordova', 'sass', 'list']).argv,
    Q = require('q'),
    FormData = require('form-data'),
+   IonicAppLib = require('ionic-app-lib'),
+   IonicProject = IonicAppLib.project,
-   IonicProject = require('./project'),
    IonicStore = require('./store').IonicStore,
    Task = require('./task').Task,
    LoginTask = require('./login'),
-   IonicAppLib = require('ionic-app-lib'),
    Share = IonicAppLib.share,
    log = IonicAppLib.logging.logger,
    Login = IonicAppLib.login,
    Utils = IonicAppLib.utils;

To find its location (assuming that you installed Ionic CLI globally) execute the following command:

npm root -g

#5

@iignatov

Thanks. That fixed it for me.


#6

+1, after modifying share.js it works now, thanks!


#7

Same for me, works fine after the workaround !