antwarjs / antwar

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

"Error: Cannot find module 'antwar'" on macOS Sierra #104

Closed nkkollaw closed 7 years ago

nkkollaw commented 8 years ago

I've followed the installation instructions, but I'm getting the following error:

module.js:341
    throw err;
    ^

Error: Cannot find module 'antwar'
    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> (/usr/local/lib/node_modules/antwar-cli/index.js:9:14)
    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 Function.Module.runMain (module.js:447:10)`

Any idea what could be wrong..?

bebraw commented 8 years ago

Hi,

I see now. antwar-cli expects antwar as a peer dependency. That explains the error. The question is, what's the right fix.

The reason for that is that I use it per project (project dep) and maintain antwar's version separately. If the cli fixed that, then I would have to keep on updating the cli.

I guess the simplest way would be to install antwar globally as well (npm i antwar -g). This way the cli works globally and you can still control the exact version per project as local packages should get precedency.

Can you try this? If it works, I'll amend the documentation. There are a few other fixes I need to make too.

Thanks for the interest in the project.

nkkollaw commented 8 years ago

Yes, it works!

It would be nice if we didn't have to install globally, but not much of a problem.

nkkollaw commented 8 years ago

Talked too soon:

2016.08.06.13.03.00 Start developing

module.js:341
    throw err;
    ^

Error: Cannot find module 'webpack/lib/removeAndDo'
    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> (/Users/nbrogi/dev/tmp/antwar/project/node_modules/extract-text-webpack-plugin/ExtractedModule.js:30:42)
    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)
bebraw commented 8 years ago

Can you push your project somewhere? How did you initialize it?

flexzuu commented 7 years ago

I am experiencing the same issues. I tried to install antwar but i get this error after running project-folder ➜ antwar --init antwar-test:

module.js:472
    throw err;
    ^

Error: Cannot find module 'antwar'
    at Function.Module._resolveFilename (module.js:470:15)
    at Function.Module._load (module.js:418:25)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/usr/local/lib/node_modules/antwar-cli/index.js:9:14)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)

I installed antwar via npm with: npm i antwar-cli -g

bebraw commented 7 years ago

Hi,

The CLI isn't supported at the moment. I replaced it with a little bootstrap script in the current beta. That simplifies things somewhat.

The repository root contains a couple of basic examples. You can also check out webpack.js.org source.

Note that the generator is primarily only for my own usage so the available support is somewhat minimal unless there's some kind of commercial aspect to it.

bebraw commented 7 years ago

I revamped the way a project is initialized. Please see the docs for details. The repo has a couple of examples as well. Open separate issues if you still run into trouble with the new setup.