代码之家  ›  专栏  ›  技术社区  ›  MrSir

使用angular cli创建angular项目时出现问题

  •  2
  • MrSir  · 技术社区  · 7 年前

    我使用的是Windows 10,在使用 angular cli 为了创建和运行angular项目,今天我注意到我仍然可以使用 ng serve 但当我尝试用 ng new *name* 我在创建日志的末尾有以下警告:

    npm WARN rollback Rolling back minimist@1.2.0 failed (this is probably harmless): EPERM: operation not permitted, lstat 'C:\Users\Talon\Desktop\angular\angular-essentials-two\routing\node_modules\fsevents\node_modules\rc\node_modules'
    npm WARN @angular-devkit/schematics@0.0.51 requires a peer of @angular-devkit/core@0.0.28 but none is installed. You must install peer dependencies yourself.
    npm WARN @schematics/angular@0.1.16 requires a peer of @angular-devkit/core@0.0.28 but none is installed. You must install peer dependencies yourself.
    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.3 (node_modules\fsevents):
    npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
    

    如果我试着去项目中运行 ng发球 我有

    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\Talon\Desktop\angular\angular-essentials-two\routing\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)
    

    我在谷歌上搜索发现了这个 fix ,但如果我想跑 npm install -g @angular-devkit/core 我有

    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.3 (node_modules\@angular-devkit\core\node_modules\fsevents):
    npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
    
    + @angular-devkit/core@0.0.28
    updated 1 package in 9.351s
    

    如果我 ng发球 我有同样的 找不到模块“@角度devkit/core” 错误

    我不知道这是否是巧合,但在几天前我更新了最新的Windows 10之前,一切都正常。 我当前的angular cli版本是 1.6.3 .

    1 回复  |  直到 7 年前
        1
  •  1
  •   Z. Bagley    7 年前

    npm install --save-dev @angular-devkit/core 将解决此问题