1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

angular-cliでCannot find module '@angular-devkit/core'エラーが出た件

Posted at

angular-cliでCannot find module '@angular-devkit/core'エラーが出た件

環境:windows

angular/angular-cli: CLI tool for Angular

ng new PROJECT-NAME
cd PROJECT-NAME
ng serve

エラーが出ました

C:\Temp\PROJECT-NAME>ng serve
module.js:472
    throw err;
    ^

Error: Cannot find module '@angular-devkit/core'
    at Function.Module._resolveFilename (module.js:470:15)
    at Function.Module._load (module.js:418:25)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (C:\Temp\PROJECT-NAME\node_modules\@angular-devkit\schematics\src\tree\virtual.js:10:16)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)

C:\Temp\PROJECT-NAME>ng --version
module.js:472
    throw err;
    ^

以下ページに同様のIssuが立っていました。
npm update -g @angular/cli

その中で解決策が以下のように提言されていました。

  1. npm update -g @angular/cli
  2. editing my package.json changing the line
    "@angular/cli": "1.6.0",
    to
    "@angular/cli": "^1.6.0",
  3. npm update
    did the trick.

という事で、"^1.6.0"に変更したら動きました。
提言者が「did the trick.」と言ってたようにトリックですね。

C:\Temp\PROJECT-NAME>ng --version

    _                      _                 ____ _     ___
   / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
  / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
 / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
/_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
               |___/

Angular CLI: 1.6.8
Node: 7.2.1
OS: win32 x64
Angular: 5.2.4
... animations, common, compiler, compiler-cli, core, forms

以下略
1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?