angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

ng new doesn't work in the latest 1.0.0-rc.1 release

Open lucipacurar opened this issue 9 years ago • 6 comments

Please provide us with the following information:

OS?

Mac OS X 10.12.4 Beta (16E183b)

Versions.

@angular/cli: 1.0.0-rc.1 node: 6.10.0 os: darwin x64 @angular/cli: error

Repro steps.

  1. sudo npm i -g @angular/cli@latest
  2. ng new ng2cli-test --skip-git

The log given by the failure.

The package "angular-cli" has been renamed to "@angular/cli". The old package will be deprecated soon.

Please take the following steps to avoid issues: "npm install --save-dev @angular/cli@latest"

You cannot use the new command inside an Angular CLI project.

Mention any other details that might be useful.

I'm running the new command inside an empty folder, not inside an existing Angular CLI project. Also I don't have the old 'angular-cli' installed on my system.

lucipacurar avatar Mar 11 '17 15:03 lucipacurar

https://www.npmjs.com/package/@angular/cli shows that the latest release is 1.0.0-rc.1 is the latest of 11 releases . But the latest is 1.0.0-rc.0 per https://github.com/angular/angular-cli/releases

Use "1.0.0-rc.0" instead.

raularagonez avatar Mar 13 '17 19:03 raularagonez

ok, I moved back to rc.0 as suggested and I get this:

ng --help
/usr/local/lib/node_modules/@angular/cli/bin/ng:95
  const hasOldDevDep = !!packageJsonProject.devDependencies['angular-cli'];
                                                           ^

TypeError: Cannot read property 'angular-cli' of undefined
    at Object.<anonymous> (/usr/local/lib/node_modules/@angular/cli/bin/ng:95:60)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.runMain (module.js:604:10)
    at run (bootstrap_node.js:394:7)
    at startup (bootstrap_node.js:149:9)
    at bootstrap_node.js:509:3

lucipacurar avatar Mar 13 '17 21:03 lucipacurar

I updated to rc.2, but the error is still there:

ng new someproj
The package "angular-cli" has been renamed to "@angular/cli". The old package will be deprecated soon.

Please take the following steps to avoid issues:
"npm install --save-dev @angular/cli@latest" 

You cannot use the new command inside an Angular CLI project.

ng --version output

ng --version
The package "angular-cli" has been renamed to "@angular/cli". The old package will be deprecated soon.

Please take the following steps to avoid issues:
"npm install --save-dev @angular/cli@latest" 

    _                      _                 ____ _     ___
   / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
  / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
 / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
/_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
               |___/
@angular/cli: 1.0.0-rc.2
node: 6.10.0
os: darwin x64
@angular/cli: error

lucipacurar avatar Mar 15 '17 17:03 lucipacurar

Try checking the parent directories for node_modules/ or angular-cli.json` and delete it.

This seems related to the following closed issues, if the problem persists I recommend asking in StackOverflow: #1079 #1045 #2174

Per @filipesilva: "Somewhere in the folders above your current one there is either a node_modules/ folder or a angular-cli.json. Basically the command is detecting that you are already a npm project."

raularagonez avatar Mar 15 '17 17:03 raularagonez

That was it :) I had a rebel package.json somewhere in the ancestor folders and that was triggering the error.

lucipacurar avatar Mar 15 '17 17:03 lucipacurar

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.