Reputation: 1471
I don't understand why ng new
is putting the new project in the parent of the current directory instead of putting it in the current directory.
[12:05:59] angular-cli
// ♥ pwd
/Users/Dan/work/angular-cli
[12:06:06] angular-cli
// ♥ ng new ang-cli-1
Could not start watchman; falling back to NodeWatcher for file system events.
Visit http://ember-cli.com/user-guide/#watchman for more info.
installing ng2
create .clang-format
create .editorconfig
create src/app/ang-cli-1.component.css
create src/app/ang-cli-1.component.html
create src/app/ang-cli-1.component.spec.ts
create src/app/ang-cli-1.component.ts
create src/app/environment.ts
create src/app/index.ts
create src/app/shared/index.ts
create src/favicon.ico
create src/index.html
create src/main.ts
create src/system-config.ts
create src/tsconfig.json
create src/typings.d.ts
create angular-cli-build.js
create angular-cli.json
create config/environment.dev.ts
create config/environment.js
create config/environment.prod.ts
create config/karma-test-shim.js
create config/karma.conf.js
create config/protractor.conf.js
create e2e/app.e2e.ts
create e2e/app.po.ts
create e2e/tsconfig.json
create e2e/typings.d.ts
create .gitignore
create package.json
create public/.npmignore
create tslint.json
create typings.json
Successfully initialized git.
⠋ Installing packages for tooling via npm
├── es6-shim (ambient)
├── angular-protractor (ambient dev)
├── jasmine (ambient dev)
└── selenium-webdriver (ambient dev)
Installed packages for tooling via npm.
[12:08:00] angular-cli
// ♥ ls
[12:08:20] angular-cli
// ♥ ls ../ang-cli-1/
angular-cli-build.js node_modules tslint.json
angular-cli.json package.json typings
config public typings.json
e2e src
[12:08:38] angular-cli
Upvotes: 2
Views: 2145
Reputation: 3932
In my case I was building an app within an app and could not remove the outer package.JSON file. I created an apps folder inside the outer project and navigated inside it. Once there I ran NPM INIT and created a simple empty package.JSON file then ran the ng new command and it worked well.
Upvotes: 1
Reputation: 116
Do you have a package.json
file in your home/user directory? I experienced this issue, then I removed package.json
and that stopped it.
I believe that angular cli looks for a package.json file, beginning in the current directory, then navigating up the directory tree until it reaches your home/user directory. It stops at the first package.json
it finds and performs the command there. If it doesn't find a package.json
file, it performs the command from the current directory.
The current version of angular-cli now returns the error You cannot use the new command inside an Angular CLI project
when there is a package.json
file in a parent directory.
Upvotes: 10
Reputation: 645
Removing package.json file from parent directory solve problem for me.
Upvotes: -1