Ionic V2 error message when creating project

I wanted to check out Ionic V2 but it does not seem to work. Any ideas what might be wrong?

This is on OS X. I followed the tutorial on http://ionicframework.com/docs/v2/getting-started/installation/

$ ionic start test2 --v2 --verbose
Task setting: title=start, name=start, summary=Starts a new Ionic project in the specified PATH, [options]=any flags for the command, =directory for the new project, [template]=Starter templates can either come from a named template,
(ex: tabs, sidemenu, blank),
a Github repo, a Codepen url, or a local directory.
Codepen url, ex: http://codepen.io/ionic/pen/odqCz
Defaults to Ionic “tabs” starter template, --appname|-a=Human readable name for the app (Use quotes around the name), --id|-i=Package name for config, ex: com.mycompany.myapp, title=Create a basic structure without Cordova requirements, boolean=true, title=Setup the project to use Sass CSS precompiling, boolean=true, title=List starter templates available, boolean=true, --io-app-id=The Ionic.io app ID to use, --template|-t=Project starter template, boolean=true, title=Start a Ionic v2 project, boolean=true, title=(with --v2 only) Use TypeScript in starter, --zip-file|-z=URL to download zipfile for starter template, module=./ionic/start, disableChangePwd=true
Utils.preprocessCliOptions _=[start, test2], no-cordova=false, w=false, sass=false, s=false, list=false, l=false, v2=true, v=false, typescript=false, -ts=false, verbose=true, $0=/usr/local/bin/ionic

One awesome Ionic app coming right up…

The directory /Users/tk/test2 already exists.
Would you like to overwrite the directory with this new project?
(yes/no): yes

Downloading: https://github.com/driftyco/ionic2-app-base/archive/master.zip
[=============================] 100% 0.0s
Downloading: https://github.com/driftyco/ionic2-starter-tabs/archive/master.zip
[=============================] 100% 0.0s
Installing Node Modules
Running exec command: npm install
Utils.fail Unable to run exec commandError: stderr maxBuffer exceeded. undefined
Utils.fail stack undefined
Utils.errorHandler is set, calling that now
Cli.Utils.errorHandler msg Unable to run exec commandError: stderr maxBuffer exceeded. string

Unable to run exec commandError: stderr maxBuffer exceeded. (CLI v2.0.0-beta.17)

Your system information:

Cordova CLI: 5.4.1
Gulp version: CLI version 3.9.0
Gulp local:
Ionic Version: 2.0.0-alpha.51
Ionic CLI Version: 2.0.0-beta.17
Ionic App Lib Version: 2.0.0-beta.8
ios-deploy version: 1.6.0
ios-sim version: 3.1.1
OS: Mac OS X El Capitan
Node Version: v0.12.6
Xcode version: Xcode 7.2 Build version 7C68

As it says maxBuffer exceeded i think it could be a memory issue, how much ram do you have?
Not an expert but maybe the permission for npm on use of ram is low or something.

I’m getting this on OSX as well. Alpha was OK, updated the CLI now and get the same.
Node version is OK, and all should be good.

I think this is node buffer, and it has nothing to do with RAM - I have 16 GB.

mikko@OSX$ ionic start test --v2

One awesome Ionic app coming right up...

Downloading: https://github.com/driftyco/ionic2-app-base/archive/master.zip
[=============================]  100%  0.0s
Downloading: https://github.com/driftyco/ionic2-starter-tabs/archive/master.zip
[=============================]  100%  0.0s
Installing Node Modules

Unable to run exec commandError: stderr maxBuffer exceeded (CLI v2.0.0-beta.17)

Your system information:

Cordova CLI: Not installed
Gulp version:  CLI version 3.9.0
Gulp local:  
Ionic Version: 2.0.0-beta.1
Ionic CLI Version: 2.0.0-beta.17
Ionic App Lib Version: 2.0.0-beta.8
ios-deploy version: Not installed
ios-sim version: 3.1.1 
OS: Mac OS X El Capitan
Node Version: v4.3.1
Xcode version: Xcode 6.4 Build version 6E35b

Is there a child process somewhere in need of more buffer size?
The default value of maxBuffer is 200KB but can be set higher in exec:

var execute = function(command, callback){
    exec(command, {maxBuffer: 1024 * 500}, function(error, stdout, stderr){ callback(error, stdout); });
};

https://nodejs.org/api/child_process.html#child_process_child_process_exec_command_options_callback

As this happens to both of you, you should make an issue in ionic github filler: Ionic issue filler

Yes, I found the point where it fails and was able to fix it locally.
It is not in the CLI, it is in driftyco/ionic-app-lib

For some reason, the standard NodeJS buffer size is not enough for the child process in ionic-app-lib/lib/start.js

In Start.runExecCommand, adding a (very) large buffer will enable ionic start to work again.
I am not sure why it requires such a large buffer, 1024 * 500 was not enough, so I ended up pumping it to 10240 * 500 just in case, and now it works…

Will make an issue next.

...

Start.runExecCommand = function runExecCommand(command) {
  var q = Q.defer();
  var childProcess = require('child_process');

  logging.logger.debug('Running exec command:', command);

  // maxBuffer here added:
  childProcess.exec(command, {maxBuffer: 10240 * 500}, function(err, stdout, stderr) {
    if (err) {
      Utils.fail('Unable to run exec command' + err);

      q.reject(err);
    } else {
      logging.logger.debug('Completed', stdout);
      q.resolve(stdout);
    }
  });

  return q.promise;
};

...

I help solve this problem as:
xkris6x@NextSofts-Server:/home/project/web/nodeJS/ionic/oea$ ionic serve

There is an error in your gulpfile:
Error: /home/project/web/nodeJS/ionic/oea/node_modules/node-sass/vendor/linux-x64-47/binding.node: failed to map segment from shared object: Operation not permitted
at Error (native)
at Object.Module._extensions…node (module.js:440:18)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Module.require (module.js:367:17)
at require (internal/module.js:20:19)
at Object. (/home/project/web/nodeJS/ionic/oea/node_modules/node-sass/lib/index.js:24:15)
at Module._compile (module.js:413:34)
at Object.Module._extensions…js (module.js:422:10)
at Module.load (module.js:357:32)

xkris6x@NextSofts-Server:/home/project/web/nodeJS/ionic/oea$ ionic start

Invalid command (CLI v2.0.0-beta.32)

Your system information:

Cordova CLI: 6.2.0
Gulp version: CLI version 3.9.1
Gulp local: Local version 3.9.1
Ionic Framework Version: 2.0.0-beta.10
Ionic CLI Version: 2.0.0-beta.32
Ionic App Lib Version: 2.0.0-beta.18
OS: Distributor ID: Debian Description: Debian GNU/Linux 8.4 (jessie)