【问题标题】:Angular failed to install on local system - npm ERR! code ERR_SOCKET_TIMEOUTAngular 无法在本地系统上安装 - npm ERR!代码 ERR_SOCKET_TIMEOUT
【发布时间】:2022-01-17 16:58:33
【问题描述】:

我已在本地系统上成功安装了 Node 和 AngularCLI。一切都很好。我有:

Angular CLI: 13.1.1
Node: 16.13.1
Package Manager: npm 8.1.2
OS: win32 x64

Angular:
...

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.1301.1 (cli-only)
@angular-devkit/core         13.1.1 (cli-only)
@angular-devkit/schematics   13.1.1 (cli-only)
@schematics/angular          13.1.1 (cli-only)

但是,当我尝试使用 ng new myproject 安装 Angular 项目时,我收到了这个错误:

- Installing packages (npm)...npm WARN deprecated flatten@1.0.3: flatten is deprecated in favor of utility frameworks such as lodash.
npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN cleanup Failed to remove some directories [
npm WARN cleanup   [
npm WARN cleanup     'C:\\Users\\BAMI\\Desktop\\MyApp\\APP-UI\\node_modules',
npm WARN cleanup     [Error: EPERM: operation not permitted, unlink 'C:\Users\BAMI\Desktop\MyApp\APP-UI\node_modules\sass\sass.dart.js'] {
npm WARN cleanup       errno: -4048,
npm WARN cleanup       code: 'EPERM',
npm WARN cleanup       syscall: 'unlink',
npm WARN cleanup       path: 'C:\\Users\\BAMI\\Desktop\\MyApp\\APP-UI\\node_modules\\sass\\sass.dart.js'
npm WARN cleanup     }
npm WARN cleanup   ],
npm WARN cleanup   [
npm WARN cleanup     'C:\\Users\\BAMI\\Desktop\\MyApp\\APP-UI\\node_modules\\less',
npm WARN cleanup     [Error: EPERM: operation not permitted, unlink 'C:\Users\BAMI\Desktop\MyApp\APP-UI\node_modules\less\lib\less\environment\abstract-plugin-loader.js'] {
npm WARN cleanup       errno: -4048,
npm WARN cleanup       code: 'EPERM',
npm WARN cleanup       syscall: 'unlink',
npm WARN cleanup       path: 'C:\\Users\\BAMI\\Desktop\\MyApp\\APP-UI\\node_modules\\less\\lib\\less\\environment\\abstract-plugin-loader.js'
npm WARN cleanup     }
npm WARN cleanup   ]
npm WARN cleanup ]
npm ERR! code ERR_SOCKET_TIMEOUT
npm ERR! network Socket timeout
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly.  See: 'npm help config'

我正在本地系统上进行安装,没有任何安全措施。

我做到了:

npm 缓存清除 --force

问题依然存在。

我该如何解决这个问题?

谢谢

【问题讨论】:

    标签: node.js angular


    【解决方案1】:

    使用此命令全局更新您的 npm

    npm install -g npm
    

    【讨论】:

    • 问题依旧
    【解决方案2】:

    检查这些步骤:

    • 测试你的连接,好像也有问题
    • 核对你的 node_modules 文件夹
    • 全局重新安装你的 npm
    • 重新安装

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-10-29
      • 2019-05-10
      • 1970-01-01
      • 2022-06-29
      • 2016-02-22
      • 2018-06-17
      • 2022-12-14
      • 2015-08-31
      相关资源
      最近更新 更多