【发布时间】:2021-01-12 04:33:08
【问题描述】:
我想在 VS 2015 上使用 angular2 创建一个环境。当我输入“npm start”时,我在下面发现了一个错误。我也在类型“npm start”之前使用了“npm cache clean --force”,但发现了同样的错误。似乎我找到了一个类似的答案来解决这个问题“https://stackoverflow.com/questions/43600838/failed-at-the-angular-quickstart1-0-0-build-script-tsc-p-src/43600902#43600902",但在这里我不明白我应该在哪里改解决它。
C:\Users\Hp>cd c:\Users\Hp\Desktop\angular\Angular3Demo\Angular3Demo
c:\Users\Hp\Desktop\angular\Angular3Demo\Angular3Demo>npm start
> angular-quickstart@1.0.0 prestart c:\Users\Hp\Desktop\angular\Angular3Demo\Angular3Demo
> npm run build
> angular-quickstart@1.0.0 build c:\Users\Hp\Desktop\angular\Angular3Demo\Angular3Demo
> tsc -p src/
node_modules/@types/node/index.d.ts(20,1): error TS1084: Invalid 'reference' directive syntax.
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! angular-quickstart@1.0.0 build: `tsc -p src/`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the angular-quickstart@1.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Hp\AppData\Roaming\npm-cache\_logs\2020-09-25T20_05_32_810Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! angular-quickstart@1.0.0 prestart: `npm run build`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the angular-quickstart@1.0.0 prestart script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Hp\AppData\Roaming\npm-cache\_logs\2020-09-25T20_05_32_902Z-debug.log
c:\Users\Hp\Desktop\angular\Angular3Demo\Angular3Demo>
包.json
{
"name": "angular-quickstart",
"version": "1.0.0",
"description": "QuickStart package.json from the documentation, supplemented with testing support",
"scripts": {
"build": "tsc -p src/",
"build:watch": "tsc -p src/ -w",
"build:e2e": "tsc -p e2e/",
"serve": "lite-server -c=bs-config.json",
"serve:e2e": "lite-server -c=bs-config.e2e.json",
"prestart": "npm run build",
"start": "concurrently \"npm run build:watch\" \"npm run serve\"",
"pree2e": "npm run build:e2e",
"e2e": "concurrently \"npm run serve:e2e\" \"npm run protractor\" --kill-others --success first",
"preprotractor": "webdriver-manager update",
"protractor": "protractor protractor.config.js",
"pretest": "npm run build",
"test": "concurrently \"npm run build:watch\" \"karma start karma.conf.js\"",
"pretest:once": "npm run build",
"test:once": "karma start karma.conf.js --single-run",
"lint": "tslint ./src/**/*.ts -t verbose"
},
"keywords": [],
"author": "",
"license": "MIT",
"dependencies": {
"@angular/common": "~4.3.4",
"@angular/compiler": "~4.3.4",
"@angular/core": "~4.3.4",
"@angular/forms": "~4.3.4",
"@angular/http": "~4.3.4",
"@angular/platform-browser": "~4.3.4",
"@angular/platform-browser-dynamic": "~4.3.4",
"@angular/router": "~4.3.4",
"angular-in-memory-web-api": "~0.3.0",
"systemjs": "0.19.40",
"core-js": "^2.4.1",
"rxjs": "5.0.1",
"zone.js": "^0.8.4"
},
"devDependencies": {
"concurrently": "^3.2.0",
"lite-server": "^2.2.2",
"typescript": "~2.1.0",
"canonical-path": "0.0.2",
"tslint": "^3.15.1",
"lodash": "^4.16.4",
"jasmine-core": "~2.4.1",
"karma": "^1.3.0",
"karma-chrome-launcher": "^2.0.0",
"karma-cli": "^1.0.1",
"karma-jasmine": "^1.0.2",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~4.0.14",
"rimraf": "^2.5.4",
"@types/node": "^6.0.46",
"@types/jasmine": "2.5.36"
},
"repository": {}
}
我是初学者,请帮助。
【问题讨论】:
-
您是否检查了位于 C:\Users\Hp\AppData\Roaming\npm-cache_logs\2020-09-25T20_05_32_902Z-debug.log 的日志文件
-
您的
package.json似乎还可以尝试再次删除node_modules文件夹和npm install项目 -
@AmitKumarSingh 我在我的 AppData 文件夹中显示。仍然无法正常工作。我不明白这是什么解决方案?
-
@ajvg94 不工作,同样的错误。
标签: javascript node.js angular typescript npm