generate / generate-gitignore

Generate a .gitignore file from the command line when Generate's CLI is installed globally, or use as a plugin or sub-generator in your own generator.
https://github.com/generate
MIT License
113 stars 12 forks source link

TypeError: Cannot read property 'replace' of undefined #4

Closed onokumus closed 7 years ago

onokumus commented 7 years ago
$ gen gitignore
[13:13:42] starting generate
[13:13:42] ✔ running tasks: [ 'gitignore' ]
/home/archie/.node_modules/lib/node_modules/generate/lib/defaults.js:21
    return key.replace(app.get('aliasRegex'), '');
              ^

TypeError: Cannot read property 'replace' of undefined

node : v7.5.0 npm : v4.1.2 os : Linux 4.9.6-1

doowb commented 7 years ago

@onokumus are you running this in an existing project/folder?

Also... please try running with gen gitignore -v to show the entire stacktrace and post that here to help debug.

onokumus commented 7 years ago

@doowb I installed it globally with the command

npm install --global generate generate-project

Then I give the

gen project

command in an empty project-folder. It gives the error above. I searched one by one to see which modules did not work. I saw the generate-gitignore module not working. The others are working. For example, generate-readme. But the generate-gitignore module does not work.

In addition, the output of the command

gen gitignore -v

is the same as the error above.

doowb commented 7 years ago

@onokumus thanks for the additional information, I didn't notice that you were running on linux before.

I was able to confirm this on ubuntu with node 7.5.0 and 6.9.5, but it might take some time to debug (mainly because linux isn't my default dev environment).

onokumus commented 7 years ago

Thanks @doowb

doowb commented 7 years ago

@onokumus this should be fixed. You should uninstall both generate and generate-project from the global node modules:

npm uninstall -g generate generate-project

Then I usually clear the npm cache before reinstalling:

npm cache clear && npm cache clear -g

Then reinstall with the command you used above:

npm install --global generate generate-project

Let us know if you have any more issues.

onokumus commented 7 years ago

@doowb Thanks. It's work!.