使用NPM进行编译时出错

时间:2017-05-24 05:24:54

标签: angular npm angular-cli npm-install

我是angularjs的新手,我有一个角度框架的项目文件,我目前是新的,我们实际上有两个文件,一个工作正常但另一个没有,他们的其他项目文件有一个.bin就可以了工作得很好,我们正在修补的另一个没有.bin文件夹,我们如何生成.bin文件夹或者我们如何修复下面显示的错误:

  

ERROR in Error遇到静态解析符号值。调用函数'ɵmakeDecorator',不支持函数调用。考虑使用对导出函数的引用替换函数或lambda,在C:/ xampp / htdocs / my-app / node_modules / angular-datatables / node_modules / @ angula r / core / core.d.ts中解析符号NgModul e ,解决C:/ xampp / htdocs / my-app / no de_modules / angular-datatables / src / angular-datatables.module.d.ts中的符号DataTablesModule,解决C:/ xampp / htdocs / my-app中的符号DataTablesModule / node_modules / angular-datatables / sr c / angular-datatables.module.d.ts

运行npm run ng serve时收到错误消息“not a binary etc”。所以我将一个正在运行的应用程序的bin文件夹复制到当前的应用程序,它只能运行命令我收到上面的错误信息。

以下是 package.json 的内容:

{
  "name": "my-app",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^4.0.1",
    "@angular/common": "^4.0.0",
    "@angular/compiler": "^4.0.0",
    "@angular/core": "^4.0.0",
    "@angular/forms": "^4.0.0",
    "@angular/http": "^4.0.0",
    "@angular/platform-browser": "^4.0.0",
    "@angular/platform-browser-dynamic": "^4.0.0",
    "@angular/router": "^4.0.0",
    "@types/datatables.net": "^1.10.1",
    "angular-datatables": "^4.1.0",
    "angular2-busy": "^2.0.3",
    "angular2-datatable": "^0.6.0",
    "angular2-highcharts": "^0.5.5",
    "angular2-notifications": "^0.4.53",
    "angulartics-google-analytics": "^0.4.0",
    "angulartics2": "^2.2.1",
    "chart.js": "^2.5.0",
    "core-js": "^2.4.1",
    "datatables.net": "^1.10.15",
    "datatables.net-dt": "^1.10.15",
    "jquery": "^3.2.1",
    "ng2-charts": "^1.5.0",
    "ng2-dropdown-multiselect": "^1.2.0",
    "ng2-select": "^1.2.0",
    "ng2-slim-loading-bar": "^4.0.0",
    "ng2-toastr": "^4.0.1",
    "ngDfp": "^0.16.0",
    "rxjs": "^5.1.0",
    "sweetalert2": "^6.5.6",
    "toastr-ng2": "^4.1.1",
    "zone.js": "^0.8.4"
  },
  "devDependencies": {
    "@angular/cli": "1.0.0",
    "@angular/compiler-cli": "^4.0.0",
    "@types/datatables.net": "^1.10.1",
    "@types/jasmine": "2.5.38",
    "@types/jquery": "^2.0.45",
    "@types/node": "~6.0.60",
    "angular-2-dropdown-multiselect": "^1.1.0",
    "codelyzer": "~2.0.0",
    "jasmine-core": "~2.5.2",
    "jasmine-spec-reporter": "~3.2.0",
    "karma": "~1.4.1",
    "karma-chrome-launcher": "~2.0.0",
    "karma-cli": "~1.0.1",
    "karma-coverage-istanbul-reporter": "^0.2.0",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.1.0",
    "ts-node": "~2.0.0",
    "tslint": "~4.5.0",
    "typescript": "~2.2.0"
  }
}

当我运行npm start时,收到此错误消息:

$ npm start
  
    

my-app@0.0.0启动C:\ xampp \ htdocs \ my-app     服务

  
     

'ng'未被识别为可操作的内部或外部命令   程序或批处理文件      错误的ERR!代码ELIFECYCLE npm ERR!错误1     错误的ERR! my-app@0.0.0 start:ng serve npm ERR!退出状态1 npm   呃!错误的ERR!在my-app@0.0.0启动脚本失败。错误的ERR!这个   npm可能不是问题。可能还有其他日志记录   以上输出。

     

npm ERR!可以在以下位置找到此运行的完整日志:npm ERR!
  C:\ Users \用户lboadilla \应用程序数据\漫游\ NPM-cache_logs \ 2017-05-24T05_42_53_038Z-的debug.log

当我使用命令 npm install 时,我得到:

    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.1: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN angular2-datatable@0.6.0 requires a peer of @angular/core@^2.0.0 but none was installed.
npm WARN angular2-datatable@0.6.0 requires a peer of @angular/common@^2.0.0 but none was installed.
npm WARN angular2-datatable@0.6.0 requires a peer of @angular/platform-browser@^2.0.0 but none was installed.
npm WARN ng2-charts@1.5.0 requires a peer of @angular/common@^2.3.0 but none was installed.
npm WARN ng2-charts@1.5.0 requires a peer of @angular/core@^2.3.0 but none was installed.
npm WARN angulartics-google-analytics@0.4.0 requires a peer of angulartics@^1.0.0 but none was installed.
npm WARN toastr-ng2@4.1.1 requires a peer of @angular/core@^2.2.0 but none was installed.
npm WARN toastr-ng2@4.1.1 requires a peer of @angular/common@^2.2.0 but none was installed.
npm WARN angular2-notifications@0.4.53 requires a peer of @angular/core@^2.1.2 but none was installed.
npm WARN angular2-notifications@0.4.53 requires a peer of @angular/common@^2.1.2 but none was installed.
npm WARN angular2-notifications@0.4.53 requires a peer of @angular/platform-browser@^2.1.1 but none was installed.
npm WARN ng2-select@1.2.0 requires a peer of @angular/common@^2.3.0 but none was installed.
npm WARN ng2-select@1.2.0 requires a peer of @angular/core@^2.3.0 but none was installed.
npm WARN angular-2-dropdown-multiselect@1.3.2 requires a peer of tslib@^1.6.1 but none was installed.
npm WARN The package @types/datatables.net is included as both a dev and production dependency.

使用 windows

1 个答案:

答案 0 :(得分:0)

要安装角度cli,请使用以下命令

npm install -g @angular/cli@latest

全球包装:

npm uninstall -g angular-cli @angular/cli
npm cache clean
npm install -g @angular/cli@latest

本地项目包:

rm -rf node_modules dist # On Windows use rmdir /s /q node_modules dist
npm install --save-dev @angular/cli@latest
npm install
ng init