【问题标题】:Error: Cannot find module '@angular/compiler'错误:找不到模块'@angular/compiler'
【发布时间】:2019-07-03 04:12:11
【问题描述】:

我下载了一个角度模板,运行“ng serve”时收到:

找不到模块“@angular/compiler”错误:找不到模块 '@angular/编译器' ...

然后我尝试了 google 上出现的所有内容,包括查看依赖项并重新安装所有内容。

然后使用此命令卸载 npm:

sudo npm uninstall angular-cli

我明白了:

未处理的拒绝错误:命令失败:/usr/bin/git clone --depth=1 -q -b fix-drag-issue git://github.com/swimlane/dragula.git /Users/angellolazar/.npm/_cacache/tmp/git-clone-c0a842b4 /Users/angellolazar/.npm/_cacache/tmp/git-clone-c0a842b4/.git: 权限被拒绝

at ChildProcess.exithandler (child_process.js:294:12)
at ChildProcess.emit (events.js:189:13)
at maybeClose (internal/child_process.js:970:16)
at Socket.stream.socket.on (internal/child_process.js:389:11)
at Socket.emit (events.js:189:13)
at Pipe._handle.close (net.js:600:12)

⸨░░░░░░⸩⠹提取物:npm:窗台提取物strip-ansi@3.0.1

现在,在查看我的 Angular 版本时,我收到:

Angular: ...动画、cdk、通用、编译器、核心、表单、 http ...语言服务,平台浏览器,平台浏览器动态 ...路由器

一团糟...请让我知道您可能需要哪些其他信息才能解决此问题。

【问题讨论】:

  • 除非您全局安装,否则您应该能够删除您尝试安装的文件夹。然后你应该可以重新开始了。

标签: javascript node.js angular npm terminal


【解决方案1】:

我认为通过卸载所有内容,他们意味着删除您的 node_modules 文件夹并再次安装所有依赖项。因此,只需删除您的 node_modules 文件夹并执行 npm install

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-07-23
    • 2018-02-04
    • 2019-11-02
    • 2020-05-25
    • 1970-01-01
    • 1970-01-01
    • 2020-11-21
    • 2021-11-01
    相关资源
    最近更新 更多