简体   繁体   English

当我输入这个命令“npm install”时不安装 node_modules

[英]not install node_modules when I type this command "npm install"

when i install node_modules with this command npm install , I get below errors.当我使用此命令npm install安装 node_modules 时,出现以下错误。 in this case, how can fix this errors?在这种情况下,如何修复此错误?

npm ERR! errno HPE_INVALID_CONSTANT
npm ERR! request to https://registry.npmjs.org/acorn/-/acorn-5.7.2.tgz failed, reason: Parse Error

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\IR-16\AppData\Roaming\npm-cache\_logs\2019-03-25T10_35_26_869Z-debug.log

my package.json is following:我的 package.json 如下:

{
  "name": "discover",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^6.1.0",
    "@angular/common": "^6.1.0",
    "@angular/compiler": "^6.1.0",
    "@angular/core": "^6.1.0",
    "@angular/forms": "^6.1.0",
    "@angular/http": "^6.1.0",
    "@angular/platform-browser": "^6.1.0",
    "@angular/platform-browser-dynamic": "^6.1.0",
    "@angular/router": "^6.1.0",
    "angular2-useful-swiper": "^5.0.1",
    "bootstrap": "^4.1.3",
    "core-js": "^2.5.4",
    "ng-simple-slideshow": "^1.2.4",
    "ngx-toggle-switch": "^2.0.5",
    "ngx-ui-switch": "^1.6.0",
    "rxjs": "^6.0.0",
    "swiper": "3.4.2",
    "zone.js": "~0.8.26"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.7.0",
    "@angular/cli": "~6.1.5",
    "@angular/compiler-cli": "^6.1.0",
    "@angular/language-service": "^6.1.0",
    "@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": "~1.7.1",
    "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.4.0",
    "ts-node": "~5.0.1",
    "tslint": "~5.9.1",
    "typescript": "~2.7.2"
  }
}

as you can see, never installed acorn package.如您所见,从未安装acorn包。 this error happens when i install ````node modules``` in all projects.当我在所有项目中安装````node modules``` 时会发生此错误。

Please remove "acorn": "^5.7.2", from package.json related acorn and follow the following steps,请从package.json相关的 acorn 中删除"acorn": "^5.7.2",并按照以下步骤操作,

rm -rf node_modules/
npm install

Then install acorn manually via terminal然后通过终端手动安装橡子

npm install acorn --save

If it will not work then you can try with如果它不起作用,那么你可以尝试

npm install acorn --unsafe-perm --save

Hope this will help you !!希望能帮到你 !!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM