Translate

[Angular 2+] ng 명령어 실행 시 Error: Cannot find module '@angular-devkit/core' 에러





ng 명령어 실행 시 아래와 같은 오류가 발생했다.


1004lucifer

Your global Angular CLI version (1.6.8) is greater than your local
version (1.6.0). The local Angular CLI version is used.

To disable this warning use "ng set --global warnings.versionMismatch=false".
module.js:540
    throw err;
    ^

Error: Cannot find module '@angular-devkit/core'
    at Function.Module._resolveFilename (module.js:538:15)
    at Function.Module._load (module.js:468:25)
    at Module.require (module.js:587:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (C:\Users\1004lucifer\IdeaProjects\[_PROJECT_]\node_modules\@angular-devkit\schematics\src\tree\virtual.js:10:16)
    at Module._compile (module.js:643:30)
    at Object.Module._extensions..js (module.js:654:10)
    at Module.load (module.js:556:32)
    at tryModuleLoad (module.js:499:12)
    at Function.Module._load (module.js:491:3)









아래와 같이 해결을 했다.

package.json


"devDependencies": {
    "@angular/cli": "1.6.0",   =>   "@angular/cli": "^1.6.0",
  ...



command
1004lucifer

C:\Users\1004lucifer\IdeaProjects\PROJECT\admin>yarn install
yarn install v1.3.2
[1/5] Validating package.json...
[2/5] Resolving packages...
warning Resolution field "uglify-es@3.2.2" is incompatible with requested version "uglify-es@^3.3.4"
[3/5] Fetching packages...
info fsevents@1.1.3: The platform "win32" is incompatible with this module.
info "fsevents@1.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
[4/5] Linking dependencies...
[5/5] Building fresh packages...
success Saved lockfile.
$ node node_modules/phantomjs-prebuilt/install.js
Found PhantomJS at C:\Users\1004lucifer\IdeaProjects\PROJECT\admin\node_modules\phantomjs-prebuilt\lib\phantom\bin\phantomjs.exe ...verifying
PhantomJS is previously installed at C:\Users\1004lucifer\IdeaProjects\PROJECT\admin\node_modules\phantomjs-prebuilt\lib\phantom\bin\phantomjs.exe
Done in 53.49s.

C:\Users\1004lucifer\IdeaProjects\PROJECT\admin>
C:\Users\1004lucifer\IdeaProjects\PROJECT\admin>
C:\Users\1004lucifer\IdeaProjects\PROJECT\admin>
C:\Users\1004lucifer\IdeaProjects\PROJECT\admin>ng -version
The specified command -version is invalid. For available options, see `ng help`.

C:\Users\1004lucifer\IdeaProjects\PROJECT\admin>
C:\Users\1004lucifer\IdeaProjects\PROJECT\admin>
C:\Users\1004lucifer\IdeaProjects\PROJECT\admin>ng --version

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

Angular CLI: 1.6.8
Node: 8.9.4
OS: win32 x64
Angular: 5.1.0
... common, compiler, compiler-cli, core, forms, http
... platform-browser, platform-browser-dynamic, router

@angular/cli: 1.6.8
@angular-devkit/build-optimizer: 0.0.42
@angular-devkit/core: 0.0.29
@angular-devkit/schematics: 0.0.52
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.8.5
@schematics/angular: 0.1.17
typescript: 2.5.3
webpack-dev-server: 2.9.5
webpack-merge: 4.1.1
webpack-notifier: 1.5.0
webpack-visualizer-plugin: 0.1.11
webpack: 3.10.0

C:\Users\1004lucifer\IdeaProjects\PROJECT\admin>




참고
https://github.com/angular/angular-cli/issues/9307


댓글