antwarjs / antwar

A static site generator built with React and Webpack.
https://antwar.js.org/
MIT License
460 stars 35 forks source link

Issues with installation due to registry.nodejitsu.com not available ? #106

Closed andersosthus closed 7 years ago

andersosthus commented 8 years ago

Hi,

Installation of Antwar is failing with the following error:

2016.09.13.22.03.35 Start project initialization

2016.09.13.22.03.35 Fetching boilerplate metadata
2016.09.13.22.03.37
Project initialization failed Error: connect ECONNREFUSED 173.192.57.106:80
2016.09.13.22.03.37
Time elapsed: 1 second

After looking through the code I think the issue is as follows: npm-registry is used with default options in the Antwar installer. By default, npm-registry uses http://registry.nodejitsu.com for both registry lookups and package downloads. This URI seems to be not responding.

I've tried npm-registry with http://registry.npmjs.org/ manually in the REPL, and then it manages to find the metadata package for antwar-boilerplate, but if I instantiate it with an empty options object like the Antwar installer, it fails with being unable to connect to the address above.

A quick fix would be to pass in a config object to force the use of npmjs, along the lines of:

{
  mirrors: {
    npmjs: 'http://registry.npmjs.org/'
  },
  registry: 'http://registry.npmjs.org/'
}

A better fix would, imo, be to be able to override it with a cmd line argument or something.

bebraw commented 8 years ago

Hi,

Thanks for the report. I think I'll point it to npmjs by default. That should do it.

I'm doing fairly heavy refactoring on the project right now by the way. It might be be better to look into it once I get the next major release out (a few days I hope).

andersosthus commented 8 years ago

Great :)

Also, while you're at it, the npm-registry package looks to be unmaintained. Maybe it would be worth it to switch to something like https://www.npmjs.com/package/npm-registry-client ?

I could make you some pull-requests if you'd like against whatever branch you do your refactoring in.

bebraw commented 8 years ago

@andersosthus I'm working against master (lazy, I know). Good point on npm-registry. It's worth replacing. A PR would be welcome. The cli is probably half broken at the moment, though (need to update boilerplates), but still.

andersosthus commented 8 years ago

Good,

I'll see if I can't get a PR done tonight for this :)

andersosthus commented 8 years ago

I've updated init.js and list.js now (https://github.com/andersosthus/antwar/commits/cli-npm-updates). install.js still to go.

Not sure how to actually test my changes tho, other than manually. Haven't found any tests for the antwar-cli project so far.

Some contributing docs about how to get started would be nice. Took me a while to figure out the "npm run init" command to get all packages started. I also had to disable tests on push temporarily, cause the test kept failing due to timezone differences (some tests expects something to be +1, but I'm in +2).

bebraw commented 8 years ago

Not sure how to actually test my changes tho, other than manually. Haven't found any tests for the antwar-cli project so far.

Yeah, no tests there. You can copy the convention from RSS plugin. As long as you follow a similar convention, it should pick it up.

Some contributing docs about how to get started would be nice. Took me a while to figure out the "npm run init" command to get all packages started.

Added. Thanks.

I also had to disable tests on push temporarily, cause the test kept failing due to timezone differences (some tests expects something to be +1, but I'm in +2).

Fixed. Funnily enough Travis didn't catch this.

andersosthus commented 7 years ago

I'm gonna see if I can't complete this one tonight. Been struggling a bit with the tests. Seems that a bit of refactor is needed to be able to smoothly test it.

bebraw commented 7 years ago

No worries. Take your time with it. 👍

andersosthus commented 7 years ago

I've made PR #109 for this issue. Could you take a look?

bebraw commented 7 years ago

Sure! Tomorrow. 👍

bebraw commented 7 years ago

Merged.