如何运行"npm install"为较旧的Angular项目创建node_modules文件夹? [英] How to run "npm install" to create node_modules folder for an older Angular project?

查看:102
本文介绍了如何运行"npm install"为较旧的Angular项目创建node_modules文件夹?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将代码从存储库中拉到新的笔记本电脑上.我们的项目建立在去年的Angular 5上.当然,新笔记本电脑安装了最新最好的Angular CLI,NodeJS和NPM工具,并且Angular 6刚刚发布.该笔记本电脑具有Node 8.11.2,NPM 5.6.0和Angular CLI 6.0.3.

I'm pulling our code down from our repository to a new laptop. Our project was built on Angular 5 last year. Of course, the new laptop has the latest and greatest Angular CLI, NodeJS, and NPM tools install, and Angular 6 was just released. The laptop has Node 8.11.2, NPM 5.6.0, and Angular CLI 6.0.3.

当我运行"npm install"以在该项目的新笔记本电脑上获取"node_modules"文件夹时,出现各种错误和警告,并且无法成功创建node_modules文件夹.(请参见下图).我该怎么做才能使该项目运行.我现在不一定要升级到Angular 6.我只需要继续能够运行和开发该项目即可.

When I run "npm install" to get the "node_modules" folder on my new laptop for this project, I'm getting all kinds of errors and warnings and unable to create the node_modules folder successfully (see image attached). What can I do to get this project running. I don't necessarily care about upgrading to Angular 6 at this time. I simply need to continue to be able to run and develop this project.

我们的package.json:

Our package.json:

{
  "name": "my-first-app",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve --environment=local --open",
    "build": "ng build --prod aot=false",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^5.2.0",
    "@angular/cdk": "^5.2.4",
    "@angular/common": "^5.2.0",
    "@angular/compiler": "^5.2.0",
    "@angular/core": "^5.2.0",
    "@angular/forms": "^5.2.0",
    "@angular/http": "^5.2.0",
    "@angular/material": "^5.2.4",
    "@angular/platform-browser": "^5.2.0",
    "@angular/platform-browser-dynamic": "^5.2.0",
    "@angular/router": "^5.2.0",
    "@ngui/map": "^0.20.2",
    "@types/googlemaps": "^3.30.7",
    "bootstrap": "^4.0.0",
    "core-js": "^2.4.1",
    "google-maps-coords": "^1.0.0",
    "jquery": "^3.3.1",
    "rxjs": "^5.5.6",
    "zone.js": "^0.8.19"
  },
  "devDependencies": {
    "@angular/cli": "~1.7.1",
    "@angular/compiler-cli": "^5.2.0",
    "@angular/language-service": "^5.2.0",
    "@types/jasmine": "~2.8.3",
    "@types/jasminewd2": "~2.0.2",
    "@types/node": "~6.0.60",
    "codelyzer": "^4.0.1",
    "font-awesome": "^4.7.0",
    "jasmine-core": "~2.8.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~2.0.0",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "^1.2.1",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.1.2",
    "ts-node": "~4.1.0",
    "tslint": "~5.9.1",
    "typescript": "~2.5.3"
  }
}

推荐答案

我遇到了类似的问题,删除package-lock.json并运行npm install可以为我解决.

I faced a similar issue and removing the package-lock.json and running npm install solved it for me.

这篇关于如何运行"npm install"为较旧的Angular项目创建node_modules文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆