Visual Studio 2017 npm node_module libnpmhook承诺过长

时间:2018-07-10 00:33:13

标签: visual-studio npm-install angular6

在安装npm node_module时尝试删除'libnpmhook'子模块。可以以某种方式将其从project.json中删除吗?还是我在project.json文件中错误地添加了npm?我认为npm node_module可以全局安装,不需要以某种方式在本地安装的project.json文件中包含。

原因我想从本地npm node_moduels中删除它,以及project.json文件。

在visual Studio中,当我在ng6 npm节点项目的根目录中运行此命令时,它会出现问题(它发现两个实例文件超过260个字符):

dir /s /b > out.txt 

How do I find files with a path length greater than 260 characters in Windows?

The directory name C:\src\MyNG6\node_modules\npm\node_modules\libnpmhook\node_modules\npm-registry-fetch\node_modules\make-fetch-happen\node_module
s\https-proxy-agent\node_modules\agent-base\node_modules\es6-promisify\node_modules\es6-promise\lib\es6-promise\promise is too long.
The directory name C:\src\MyNG6\node_modules\npm\node_modules\libnpmhook\node_modules\npm-registry-fetch\node_modules\make-fetch-happen\node_module
s\socks-proxy-agent\node_modules\agent-base\node_modules\es6-promisify\node_modules\es6-promise\lib\es6-promise\promise is too long.

注意:我也遵循了此建议,它没有解决260个字符限制的问题。拉主分支时仍然出现错误。

https://developercommunity.visualstudio.com/content/problem/26285/vs2017-git-checkout-branch-the-specified-path-file.html

显然,这个libnpmhook完整路径太大,以至于git无法在Visual Studio 2107内部工作。至少在我的计算机上。

当我在npm node_module内删除此子节点模块库时,一切正常。我删除了本地node_modules / npm / node_modules / libnpmhook中的“ libnpmhook”目录。

我尝试为ng6软件包安装“ npm install -g”。但是,当我尝试运行“ ng serve”时,我期望这些模块在本地可用。

是否可以在没有本地npm软件包的情况下使“ ng serve”工作,并且将它们全部全局安装?

这是package.json的样子:

{
  "name": "myng-ui",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e",
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^6.0.3",
    "@angular/common": "^6.0.3",
    "@angular/compiler": "^6.0.3",
    "@angular/core": "^6.0.3",
    "@angular/forms": "^6.0.3",
    "@angular/http": "^6.0.3",
    "@angular/platform-browser": "^6.0.3",
    "@angular/platform-browser-dynamic": "^6.0.3",
    "@angular/router": "^6.0.3",
    "@auth0/angular-jwt": "^2.0.0",
    "bootstrap": "^4.1.1",
    "core-js": "^2.5.4",
    "font-awesome": "^4.7.0",
    "moment": "^2.22.2",
    "ng-sidebar": "^7.2.0",
    "ngx-bootstrap": "^3.0.0",
    "ngx-moment": "^3.0.1",
    "npm": "^6.1.0",
    "rxjs": "^6.0.0",
    "zone.js": "^0.8.26"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.6.6",
    "@angular/cli": "^6.0.8",
    "@angular/compiler-cli": "^6.0.3",
    "@angular/language-service": "^6.0.3",
    "@types/jasmine": "~2.8.6",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "~8.9.4",
    "codelyzer": "~4.2.1",
    "jasmine-core": "~2.99.1",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "^2.0.3",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.0",
    "karma-jasmine": "~1.1.1",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.3.0",
    "ts-node": "~5.0.1",
    "tslint": "~5.9.1",
    "typescript": "~2.7.2"
  }
}

1 个答案:

答案 0 :(得分:0)

无需更改其他任何内容,只需执行以下操作:

npm uninstall npm

然后:

npm install -g npm

某人(很可能是偶然地)执行了以下操作:

npm install npm --save   

或(reference

npm install npm --save-dev

Visual Studio ide和dist部署很可能会注意到显着的改进,并减小了项目和缩小代码的大小。