When I run the ember new command to create a new project, the project gets created in my home directory instead of the directory the new command is executed from.
Anyone know why?
You have to use the ember init command if you want to create a new project in the current folder.
From the docs for init and new commands (http://www.ember-cli.com/#using-ember-cli):
ember new <project-name> description:
"Creates a folder called
<project-name> and generates an application structure for you."
ember init description:
"Generates an application structure for you in the current folder."
Better descriptions can be found in the source code for the init and new commands (https://github.com/ember-cli/ember-cli/blob/18d377b264859548f41aba6c3ea2015b90978068/lib/commands/new.js and https://github.com/ember-cli/ember-cli/blob/18d377b264859548f41aba6c3ea2015b90978068/lib/commands/init.js):
ember new <project-name> description is:
"Creates a new folder and runs
ember initin it."
The ember init description is:
"Creates a new ember-cli project in the current folder."
The relevant part of the ember new <project-name> code is:
return createAndStepIntoDirectory
.run({
directoryName: packageName,
dryRun: commandOptions.dryRun
})
.then(initCommand.run.bind(initCommand, commandOptions, rawArgs))
.then(gitInit.run.bind(gitInit, commandOptions, rawArgs));
So the new command creates and steps into the project directory name you pass into it and then runs init in that directory which generates all the ember goodness.
Note that the ember new <project-name> command also creates a git repository for you (if you have set up git on your machine) but the ember init command does not.
I had a package.json file in my root directory. Deleting it fixed the issue for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With