Ember.js - ember new team installing a project in the home directory instead of the current directory

When I run the ember new command to create a new project, the project is created in my home directory instead of the directory from which the new command is executed.

Does anyone know why?

+6
source share
2 answers

I had a package.json file in the root directory. Removing this fixed the problem for me.

+6
source

You need to use the ember init command if you want to create a new project in the current folder.

In the docs for the init and new commands ( http://www.ember-cli.com/#using-ember-cli ):

ember new <project-name> description:

"Creates a folder named <project-name > and creates the application structure for you."

ember init description:

"Creates 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> :

"Creates a new folder and runs ember init in it."

Description of ember init :

"Creates a new ember-cli project in the current folder."

Corresponding piece of code ember new <project-name> :

 return createAndStepIntoDirectory .run({ directoryName: packageName, dryRun: commandOptions.dryRun }) .then(initCommand.run.bind(initCommand, commandOptions, rawArgs)) .then(gitInit.run.bind(gitInit, commandOptions, rawArgs)); 

Thus, the new command creates and executes the steps in the name of the project directory that you pass into it, and then runs init in that directory, which generates all the ember properties.

Note that the ember new <project-name> command also creates a git repository for you (if you configured git on your computer), but the ember init command does not work.

+8
source

Source: https://habr.com/ru/post/984656/


All Articles