You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Provide a way to generate a new project in an existing directory #5431
This is already possible, try using this arguments:
ng new appName --directory ./
Reacted by Raul Rotundo, Denys Vuika, qtopie, Saiyaff Farouk, Rahul, Austin Pio, Droid Kree, Juan Tenorio Arzola, Alexander Maru, Luis Abarca and 347 more
Reacted by Shibiko, Alex Borysov, George, Kyle Holzinger, Simone Tallevi-Diotallevi, Eugen Sunic, Florian, Olutunmbi Banto, helloWorld-EHoT, Alp and 2 more
Reacted by Felipe Neuhauss Araújo, igor milla, Danang Puspito Jati, vaibhav, owaisecomply, justin-hampton, Renan Maciel, Toni Saario, Oleksandr, Gaspa79 and 19 more
Reacted by justin-hampton, Claudio Holanda Jr., hxrox, Alex Hetmanenko, Oleksandr, Stefan Edberg, Rizwan Zia, Andri Andresson, iftemplar, Kalpesh and 22 more
Reacted by Seth Broweleit, Kyle Holzinger, Eugen Sunic, Максим Иванов and Hussam
Reacted by Manoj, st3s0f, Barbara, Yuvaraj V, Claudio Holanda Jr., hxrox, Stefan Kern, Oleksandr, Aditya Vikas Devarapalli, Rizwan Zia and 24 more
Reacted by Rich Sollenne, Abderrahime FARHANE, Petr Juna, Neonox31, Suman Barick, Matt Honeycutt, Tom Matheussen, F0rt1s, Alexis Athlani, Paul Kocher and 23 more
I am running angular-cli as a project dependency (i.e. not installed globally), in an existing node electron project.
I want to initialize the existing project as angular project, copying/adding the file structure to the existing project.
The command ng new appName --directory ./ does not work, as I get: You cannot use the new command inside an Angular CLI project.
My project does not have any angular-cli.json file, but it has the angular-cli node_modules folder and is listed as dependency in package.json.
Since ng init command is no longer available, is there a way of achieving what I want to do?
I'm using Node.js 7.9.0, npm 4.6.1, and the local angular-cli version is same as npm.
Reacted by Alex Hetmanenko, Juan Garassino, Travis Bock, krychuq1, Neonox31, Eliminator1994, Gaspa79, Vitor Bruno de Oliveira Barth, Sergey Kryvets, Grímur Daníelsson and 6 more
Work around i've found is to be one level higher then the directory you want.
Ex:
-develop (here)
-- project_folder (where you want to init angular)
so the command would be; ng new myAwesomeApp --directory project_folder
Reacted by Rebeccazmf, Aki, Anner Visser, cmdallas, Diego Moreira, Anand Rockzz, Theophilus Omoregbee, karocksjoelee, Norjin, Alexey Rogachev and 11 more
Reacted by Anand Rockzz, Ashell F_ and Suraj Bera
Reacted by Anand Rockzz, Theophilus Omoregbee, Arvind-Muthuraman-Coda, Olutunmbi Banto, Ashell F_, Frank Martin, Taras Ilyin, Rilwan Olabode Soyoye, Moritz and Suraj Bera
Reacted by Anand Rockzz, Olutunmbi Banto, Ashell F_, Taras Ilyin and Suraj Bera
ng new appName --directory ./ is failing for Angular CLI: 6.0.1
Error message is:
Schematic input does not validate against the Schema: {"dryRun":false,"directory":".","version":"6.0.1","skipGit":false,"skipInstall":false,"linkCli":false,"commit":true,"newProjectRoot":"projects","inlineStyle":false,"inlineTemplate":false,"routing":false,"prefix":"app","style":"css","skipTests":false}
Errors:
Data path ".directory" should match format "path".
Although, going back up one directory and doing this is fine: ng new appName --directory project_folder
Also: is there a reason why the --directory flag is missing from ng new --help?
It could save at least one Google search :)
Reacted by Alexey Rogachev, MikeDabrowski, Dominic Elm, Dawid, Alice Yu, Kalpesh, Dominik Myszkowski, e-pavlova and Joey Gallegos
ng new appName --directory ./ only works if its a fresh blank directory. Say i have an express app created already and i want to install and create a cli app , it won't allow as having a package.json already present there. Can this append to the package.json and help people out.
For now i did a workaround where renamed my existing package.json and copied things back.
cd ../
ng new my-project --directory './existing-folder'
Works like a charm.
Reacted by Shane Jordan, Максим Иванов, Kir Yusupov, Guilherme Caraciolo, Yahya Kacem, Jon Besga, eguillou, Pablo Diaz Acosta, Artem, Markus Kollers and 3 more
Not working with @angular/cli 7.0.5. ng new proj-name --directory . creates a new directory proj-name in the current directory. Same as without the --directory flag.
Reacted by Nwel, Wenzhao Hu, Uri Berman and Daniel Betts
Activity
alvaro450 commentedon Mar 17, 2017
This is already possible, try using this arguments:
ng new appName --directory ./
filipesilva commentedon Mar 18, 2017
Closing as answered by @alvaro450, thanks!
sokraflex commentedon Feb 16, 2018
This does not work.
I used exactly the command described above, result:
Error: Schematic input does not validate against the Schema: {"directory":"./","name":"appName","skipGit":false,"style":"css","version":"1.7.0","commit":{"message":"chore: initial commit from @angular/cli\n\n _ _ ____ _ ___\n / \\ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|\n / △ \\ | '_ \\ / _\\` | | | | |/ _\\` | '__| | | | | | |\n / ___ \\| | | | (_| | |_| | | (_| | | | |___| |___ | |\n/_/ \\_\\_| |_|\\__, |\\__,_|_|\\__,_|_| \\____|_____|___|\n |___/\n","name":"Angular CLI","email":"angular-cli@angular.io"},"path":"app","sourceDir":"src","inlineStyle":false,"inlineTemplate":false,"routing":false,"prefix":"app","skipTests":false,"skipInstall":false,"linkCli":false,"minimal":false,"serviceWorker":false} Errors: .directory should match format "path"javlc commentedon Feb 18, 2018
I am running angular-cli as a project dependency (i.e. not installed globally), in an existing node electron project.
I want to initialize the existing project as angular project, copying/adding the file structure to the existing project.
The command
ng new appName --directory ./does not work, as I get:You cannot use the new command inside an Angular CLI project.My project does not have any
angular-cli.jsonfile, but it has the angular-clinode_modulesfolder and is listed as dependency inpackage.json.Since
ng initcommand is no longer available, is there a way of achieving what I want to do?I'm using Node.js 7.9.0, npm 4.6.1, and the local angular-cli version is same as npm.
markopill commentedon Mar 7, 2018
for me just
ng new appNamedid the trickit generated inside existing directory
Angular CLI: 1.7.2 Node: 6.11.3 OS: win32 x64
WaveMeUp commentedon Mar 12, 2018
I get the same error as @javlc, solution from @markopill didn't work either.
Angular CLI: 1.7.3, Ndoe: 8.1.3, OS: Windows 10 x64
ab0ris commentedon Mar 17, 2018
ng new proj_name --directory ./is not working for me as well producing the following error:
PS: not even working with absolute paths, it's trying to re-create entire directory structure inside project's folder.
thismarcoantonio commentedon Mar 23, 2018
Should be a bug,
.directory should match format "path"also showing for me.Also, I made
--directory ./in the past and it worked before...matthewwwillard commentedon Mar 29, 2018
Work around i've found is to be one level higher then the directory you want.
Ex:
-develop (here)
-- project_folder (where you want to init angular)
so the command would be; ng new myAwesomeApp --directory project_folder
TylerGubala commentedon Mar 31, 2018
Additionally I get
If I'm trying to add this to a project where I have already put a lot of work into the gitignore/ README. Bummer.
Akiq2016 commentedon Apr 3, 2018
@matthewwwillard it works for me, thanks!
ng new myAwesomeApp --directory project_folderjericdeleon commentedon May 11, 2018
ng new appName --directory ./is failing for Angular CLI: 6.0.1Error message is:
Although, going back up one directory and doing this is fine:
ng new appName --directory project_folderAlso: is there a reason why the
--directoryflag is missing fromng new --help?It could save at least one Google search :)
Amitesh commentedon May 12, 2018
Thanks @jericdeleon
It works for me. Thanks. 👍
skrzepij commentedon Jun 30, 2018
@jericdeleon in Angular CLI 6 try to use
--directory .- works for me.sebastiandg7 commentedon Jul 6, 2018
For folks having the same situation as @TylerGubala. Just backup those files and replace them after the project generation.
NOTE: Make sure the .gitignore file includes, at least, all of the generated .gitignore configuration.
abhishek-g commentedon Jul 13, 2018
ng new appName --directory ./ only works if its a fresh blank directory. Say i have an express app created already and i want to install and create a cli app , it won't allow as having a package.json already present there. Can this append to the package.json and help people out.
For now i did a workaround where renamed my existing package.json and copied things back.
ip7e commentedon Aug 2, 2018
I had the same problem about README.md file.
I run the
ng newcommand from the upper directoryWorks like a charm.
pcnate commentedon Aug 8, 2018
I ended up just copying the files manually. Is there an issue created to get this added to the documentation and maybe even to all
./?narendrasinghrathore commentedon Nov 6, 2018
Yes to create angular new project using cli in existing directory
ng new project_name --directory .
Tested in angular 7
charsi commentedon Nov 13, 2018
Not working with @angular/cli 7.0.5.
ng new proj-name --directory .creates a new directory proj-name in the current directory. Same as without the --directory flag.Napster2210 commentedon Mar 4, 2019
ng new app_name --directory=./works for me with below configuration.flipdoubt commentedon Mar 9, 2019
Did not work for me until I updated Node after seeing the version posted by @Napster2210.
--directory .works afternode --versionreportsv11.11.0.vanzinvestor commentedon Jul 16, 2019
cli 7.3.3 you can use
ng new --directory .for create in current directoryDanielChuDC commentedon Sep 1, 2019
ng new --directory .works with the configuration below:angular-automatic-lock-bot commentedon Oct 2, 2019
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.