CLI only installs to root directory
Select one of the following:
I am filing a bug.
In this case you need the following information:
- Mac OSX (El Capitan?)
- Versions. Please run
ng --version. If there's nothing outputted, please run in a Terminal:
angular-cli: 1.0.0-beta.0 node: 4.4.3 os: darwin x64 npm: 2.15.1
npm info angular-cli And paste the result here.
{ name: 'angular-cli', time: { modified: '2016-05-06T18:18:54.950Z', created: '2014-10-07T04:34:38.078Z', '1.0.0': '2014-10-07T04:34:38.078Z', '0.0.0': '2014-10-11T11:38:24.914Z', '0.0.1': '2015-08-03T17:12:04.553Z', '0.0.2': '2015-10-18T17:46:40.146Z', '0.0.3': '2015-10-18T21:42:52.445Z', '0.0.4': '2015-10-19T01:14:13.216Z', '0.0.5': '2015-10-19T09:14:01.712Z', '0.0.6': '2015-10-19T09:36:51.644Z', '0.0.7': '2015-10-19T11:48:24.233Z', '0.0.8': '2015-10-19T11:51:59.318Z', '0.0.9': '2015-10-19T21:18:13.725Z', '0.0.10': '2015-10-19T22:18:13.091Z', '0.0.11': '2015-11-03T05:03:06.345Z', '0.0.12': '2015-11-15T10:10:48.551Z', '0.0.13': '2015-12-04T17:16:43.662Z', '0.0.14': '2015-12-05T01:40:39.377Z', '0.0.15': '2015-12-05T05:50:59.226Z', '0.0.16': '2015-12-10T12:23:28.722Z', '0.0.17': '2015-12-14T19:37:08.400Z', '0.0.18': '2015-12-15T12:51:47.990Z', '0.0.19': '2015-12-15T18:23:33.077Z', '0.0.20': '2015-12-15T20:39:55.357Z', '0.0.22': '2016-02-20T00:36:56.908Z', '0.0.23': '2016-02-20T01:44:13.897Z', '0.0.24': '2016-02-25T17:41:20.619Z', '0.0.25': '2016-03-10T02:10:05.410Z', '0.0.26': '2016-03-23T00:39:46.402Z', '0.0.27': '2016-03-23T22:05:56.538Z', '0.0.28': '2016-03-28T22:39:45.766Z', '0.0.29': '2016-03-30T18:10:47.060Z', '0.0.30': '2016-04-06T22:27:32.015Z', '0.0.31': '2016-04-11T18:20:32.677Z', '0.0.33': '2016-04-19T22:31:48.209Z', '0.0.34': '2016-04-26T17:56:20.524Z', '0.0.37': '2016-05-03T18:49:21.731Z', '0.0.39': '2016-05-04T16:29:23.054Z', '0.1.0': '2016-05-05T19:41:05.830Z', '1.0.0-beta.0': '2016-05-06T18:18:54.950Z' }, maintainers: [ 'angularcore [email protected]', 'rodyhaddad [email protected]' ], description: 'CLI tool for Angular', versions: [ '0.0.0', '0.0.1', '0.0.2', '0.0.3', '0.0.4', '0.0.5', '0.0.6', '0.0.7', '0.0.8', '0.0.9', '0.0.10', '0.0.11', '0.0.12', '0.0.13', '0.0.14', '0.0.15', '0.0.16', '0.0.17', '0.0.18', '0.0.19', '0.0.20', '0.0.22', '0.0.23', '0.0.24', '0.0.25', '0.0.26', '0.0.27', '0.0.28', '0.0.29', '0.0.30', '0.0.31', '0.0.33', '0.0.34', '0.0.37', '0.0.39', '0.1.0', '1.0.0-beta.0' ], 'dist-tags': { latest: '1.0.0-beta.0', beta: '1.0.0-beta.0' }, readmeFilename: 'README.md', homepage: 'https://github.com/angular/angular-cli', keywords: [], repository: { type: 'git', url: 'git+https://github.com/angular/angular-cli.git' }, author: 'Angular Authors', bugs: { url: 'https://github.com/angular/angular-cli/issues' }, license: 'MIT', contributors: [ 'Rody Haddad [email protected] (http://rodyhaddad.com/)', 'Igor Minar [email protected]' ], users: { altrim: true, seachange: true }, version: '1.0.0-beta.0', main: 'lib/cli/index.js', trackingCode: 'UA-8594346-19', bin: { ng: './bin/ng' }, scripts: { test: 'node tests/runner', lint: 'eslint .' }, engines: { node: '>= 4.1.0' }, dependencies: { broccoli: '^1.0.0-beta.7', 'broccoli-caching-writer': '^2.2.1', 'broccoli-concat': '^2.2.0', 'broccoli-funnel': '^1.0.1', 'broccoli-merge-trees': '^1.1.1', 'broccoli-source': '^1.1.0', 'broccoli-writer': '^0.1.1', chalk: '^1.1.3', 'ember-cli': '2.5.0', 'ember-cli-string-utils': '^1.0.0', exit: '^0.1.2', 'fs-extra': '^0.30.0', glob: '^7.0.3', leek: '0.0.21', lodash: '^4.11.1', opn: '4.0.1', resolve: '^1.1.7', shelljs: '^0.7.0', 'silent-error': '^1.0.0', 'symlink-or-copy': '^1.0.3', 'systemjs-builder': '^0.15.16', typescript: '^1.8.10', typings: '^0.8.1' }, 'ember-addon': { paths: './addon/ng2/' }, devDependencies: { chai: '^3.5.0', 'clang-format': '^1.0.38', eslint: '^2.8.0', 'exists-sync': '0.0.3', minimatch: '^3.0.0', mocha: '^2.4.5', 'mock-fs': '^3.8.0', 'object-assign': '^4.0.1', rewire: '^2.5.1', sinon: '^1.17.3', through: '^2.3.8', tslint: '^3.8.1', 'walk-sync': '^0.2.6' }, gitHead: '8963e0b5704efa9171ccd12ce9dd9fe722e8ae28', dist: { shasum: 'e42a81292e409ae601147190f7f104c30f33d42b', tarball: 'https://registry.npmjs.org/angular-cli/-/angular-cli-1.0.0-beta.0.tgz' }, directories: {} }
- Repro steps. Tell us exactly what you did and how you came to the failure. If you can give us steps from the moment you created an empty application, even better! Please try to be as descriptive as you can; this will avoid unnecessary back and forth. Was this an app that wasn't created using the CLI? What change did you do on your code?
Wednesday night, May 4th, I ran this command: npm install -g angular-cli and that is it. I already had node installed. On my machine so I did nothing new that would have affected my node version. After I ran the install I ran ng new project_name from inside my project directory, which is 3 levels deep from my user directory. The project was created without any issues other than the fact that it was created directly under my user directory, 3 levels up from where I actually wanted it. I still tested the project to ensure that it worked and everything else seems to be in order.
- The log given by the failure. Normally this include a stack trace and some more information.
There was no failure.
- Mention any other details that might be useful.
I really have no other insight that I can give you. You can contact me directly if you need at [email protected].
Kind Regards, I look forward to using the CLI.
Adam Turco
Yes, same issue. App works fine, I was just putting the new projects in my $HOME directory. I posted the proof on the Gitter Channel. Versions:
angular-cli: 0.1.0 node: 4.1.2 os: darwin x64 el Capitan 10.11.4
So after doing some research this appears to be related to ember-cli issue #3792 which is closed. Not sure on more details, but will do more digging.
Apparently the cli looks for the first parent that has a package.json.
I can recreate the problem the following way.
cd ~/Desktop
mkdir rootdir
cd rootdir
npm init
mkdir appdir
cd appdir
ng new deepdir
ls
ls ..
I'm curious if the ng new command should not look for a project root getProjectRoot(). This calls the findup package and it starts looking for the closest package.json. This makes sense for commands other than ng new because this can allow commands to be run even if not in the root of the projects.
Should ng init also be in the set of commands that assume the current directory is the project root?
This happened to me as well.
ng new projectname put the project under ~/ instead of the current working directory as I expected.
Removing the ~/package.json (that shouldn't I shouldn't have left there anyways) from my system resolved the issue.
If you have a package.json in your home folder, this issue might happen since it looks for a node package in the ancestors of the current directory. This is an ember-cli issue when it does project resolution.
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.