Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allcountjs not initializing the application #147

Open
fadyhashmi opened this issue Feb 3, 2017 · 5 comments
Open

Allcountjs not initializing the application #147

fadyhashmi opened this issue Feb 3, 2017 · 5 comments

Comments

@fadyhashmi
Copy link

fadyhashmi commented Feb 3, 2017

I am having issue init allcountjs applications

allcoutjs>allcountjs init
Enter application name [helloworld-app]: test
Enter author name: faahd
Enter author email:
Enter description:
Initializing "test" application using "twenty-two-lines" template...
   create : test
   create : test\app-config
   create : test\package.json
C:\Users\Fahad\AppData\Roaming\npm\node_modules\allcountjs-cli\bin\allcount.js:85
                body.files.forEach(function (file) {
                    ^

TypeError: Cannot read property 'files' of undefined
    at Request._callback (C:\Users\Fahad\AppData\Roaming\npm\node_modules\allcountjs-cli\bin\allcount.js:85:21)
    at self.callback (C:\Users\Fahad\AppData\Roaming\npm\node_modules\allcountjs-cli\node_modules\request\request.js:186:22)
    at emitOne (events.js:96:13)
    at Request.emit (events.js:188:7)
    at Request.onRequestError (C:\Users\Fahad\AppData\Roaming\npm\node_modules\allcountjs-cli\node_modules\request\request.js:845:8)
    at emitOne (events.js:96:13)
    at ClientRequest.emit (events.js:188:7)
    at TLSSocket.socketErrorListener (_http_client.js:310:9)
    at emitOne (events.js:96:13)
    at TLSSocket.emit (events.js:188:7)

node -v is v6.9.1 and npm -v 3.10.8

@Alexey8127
Copy link
Contributor

The reason is certificate has expired, as workaround you can use this solution http://stackoverflow.com/a/21961005, it's not secure, but works, you can use it something like this in allcount.js file:

mkdir(path.join(appName, 'app-config'), function () {
    process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
    request.post('https://allcountjs.com/api/app-template-for-cli-init', {json: packageJson}, function (err, httpResponse, body) {
        var fileCounter = 0;
        if (err || httpResponse.statusCode != 200) {
            console.log("error: " + err);
            if (httpResponse) {
                console.log("response: " + httpResponse.statusCode + " " + httpResponse.body);
            }
        } else body.files.forEach(function (file) {
            write(path.join(appName, 'app-config', file.fileName), file.content, 0666, function () {
                fileCounter++;
                if (body.files.length === fileCounter) {
                    var prompt = launchedFromCmd() ? '>' : '$';
                    console.log();
                    console.log('   install dependencies:');
                    console.log('     %s cd %s && npm install', prompt, appName);
                    console.log();
                    console.log('   run the app:');
                    var mongoUrl = "mongodb://localhost:27017/" + appName;
                    if (launchedFromCmd()) {
                        console.log('     %s SET DB_URL=%s:* & npm start', prompt, mongoUrl);
                    } else {
                        console.log('     %s DB_URL=%s:* npm start', prompt, mongoUrl);
                    }
                    console.log();
                    console.log('   or');
                    console.log('     %s allcountjs run', prompt);
                    console.log();
                }
            });
        });
    })
})

@cristiandan
Copy link

@Alexey8127 So where is all this code going? in the node_module for the global allcountjs-cli ?

@Alexey8127
Copy link
Contributor

@cristiandan yes, you can try to check the allcount.js path in error message, like in the first message:

Initializing "test" application using "twenty-two-lines" template...
   create : test
   create : test\app-config
   create : test\package.json
C:\Users\Fahad\AppData\Roaming\npm\node_modules\allcountjs-cli\bin\allcount.js:85
                body.files.forEach(function (file) {
.............

@hipparchus2000
Copy link

I have a similar issue, but I suspect it is because I am behind a proxy. Googling for it I can't find a specific way to set up allcount to use a proxy.

@badlee
Copy link

badlee commented Dec 18, 2017

just type

NODE_TLS_REJECT_UNAUTHORIZED=0 allcountjs init

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants