首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >错误的应用程序不能从ng服务开始,npm安装有很多错误

错误的应用程序不能从ng服务开始,npm安装有很多错误
EN

Stack Overflow用户
提问于 2021-02-05 17:12:50
回答 2查看 2.2K关注 0票数 0

这是我的package.json

代码语言:javascript
运行
复制
{
  "name": "airworkz",
  "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": "^11.0.8",
    "@angular/cdk": "^10.2.2",
    "@angular/common": "^11.0.8",
    "@angular/compiler": "^11.0.8",
    "@angular/core": "^11.0.8",
    "@angular/fire": "^6.0.2",
    "@angular/forms": "^11.0.8",
    "@angular/google-maps": "^10.1.0",
    "@angular/platform-browser": "^11.0.8",
    "@angular/platform-browser-dynamic": "^11.0.8",
    "@angular/router": "^11.0.8",
    "@firebase/firestore": "^1.15.4",
    "@firebase/logger": "^0.2.5",
    "@firebase/util": "^0.2.49",
    "@fullcalendar/angular": "^5.5.0",
    "@fullcalendar/core": "^4.4.2",
    "@fullcalendar/daygrid": "^5.5.0",
    "@fullcalendar/interaction": "^5.5.0",
    "@fullcalendar/timegrid": "^4.4.2",
    "@types/googlemaps": "^3.39.11",
    "@types/numeral": "0.0.28",
    "bufferutil": "^4.0.1",
    "chart.js": "^2.9.3",
    "compressorjs": "^1.0.7",
    "countries-list": "^2.5.5",
    "fibers": "^3.1.0",
    "file-saver": "^2.0.5",
    "firebase": "^7.22.1",
    "firebase-tools": "^8.12.1",
    "html-webpack-plugin": "^4.3.0",
    "jspdf": "^2.1.1",
    "jspdf-autotable": "^3.5.13",
    "moment": "^2.27.0",
    "ngx-image-compress": "^11.0.3",
    "ngx-json-viewer": "^2.4.0",
    "ngx-papaparse": "^5.0.0",
    "ngx-webstorage": "^5.0.0",
    "node-forge": "^0.10.0",
    "node-sass": "^4.14.1",
    "npm-check-updates": "^10.2.5",
    "pdfmake": "^0.1.68",
    "primeflex": "^1.1.1",
    "primeicons": "^4.0.0-rc.2",
    "primeng": "^11.1.0",
    "quill": "^1.3.7",
    "rxjs": "^6.6.3",
    "tslib": "^2.1.0",
    "utf-8-validate": "^5.0.2",
    "xlsx": "^0.16.9",
    "zone.js": "^0.10.3"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^0.1101.3",
    "@angular/cli": "^11.1.3",
    "@angular/compiler-cli": "~11.0.8",
    "@types/jasmine": "~3.6.0",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "^12.11.1",
    "codelyzer": "^6.0.0",
    "jasmine-core": "~3.6.0",
    "jasmine-spec-reporter": "~5.0.0",
    "karma": "~5.2.3",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage-istanbul-reporter": "~2.1.0",
    "karma-jasmine": "~4.0.0",
    "karma-jasmine-html-reporter": "^1.5.0",
    "protractor": "~7.0.0",
    "ts-node": "~8.3.0",
    "tslint": "~6.1.0",
    "typescript": "~4.0.3"
  }
}

版本细节

代码语言:javascript
运行
复制
$ node -v
v12.14.1
$ npm -v
6.14.11

$ ng --version
Your global Angular CLI version (11.1.4) is greater than your local version (11.1.3). The local Angular CLI version is used.

To disable this warning use "ng config -g cli.warnings.versionMismatch false".

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 11.1.3
Node: 12.14.1
OS: linux x64

Angular: 11.1.2
... common, core
Ivy Workspace: Yes

Package                             Version
-------------------------------------------------------------
@angular-devkit/architect           0.1101.3
@angular-devkit/build-angular       0.1101.3
@angular-devkit/core                11.1.3
@angular-devkit/schematics          11.1.3
@angular/animations                 11.0.8
@angular/cdk                        10.2.2
@angular/cli                        11.1.3
@angular/compiler                   11.0.8
@angular/compiler-cli               11.0.8
@angular/fire                       6.0.2
@angular/forms                      11.0.8
@angular/google-maps                10.1.0
@angular/platform-browser           11.0.8
@angular/platform-browser-dynamic   11.0.8
@angular/router                     11.0.8
@schematics/angular                 11.1.3
@schematics/update                  0.1101.3
rxjs                                6.6.3
typescript                          4.0.3

当我跑的时候

ng serve -禁用-主机-检查--sourceMap=false

我得到跟随错误

……

代码语言:javascript
运行
复制
Warning: /home/weilies/apps/airworkz/node_modules/canvg/lib/index.es.js depends on 'raf'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /home/weilies/apps/airworkz/node_modules/canvg/lib/index.es.js depends on '@babel/runtime/regenerator'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies



Error: ./node_modules/@angular/cdk/__ivy_ngcc__/fesm2015/scrolling.js 1630:6-30
"export 'ɵɵstaticViewQuery' (imported as 'ɵngcc0') was not found in '@angular/core'



** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **

✔ Browser application bundle generation complete.

Initial Chunk Files | Names  |    Size
main.js             | main   | 0 bytes
styles.css          | styles | 0 bytes
vendor.js           | vendor | 0 bytes

Lazy Chunk Files    | Names  |    Size
xlsx.js             | xlsx   | 0 bytes

8 unchanged chunks

Build at: 2021-02-05T17:05:11.333Z - Hash: 70d1bef703fe4a626363 - Time: 5687ms

Error: ./node_modules/@angular/cdk/__ivy_ngcc__/fesm2015/scrolling.js 1630:6-30
"export 'ɵɵstaticViewQuery' (imported as 'ɵngcc0') was not found in '@angular/core'

我所做的是运行一些npm安装一些软件包,然后它搞砸了ng服务,然后我决定删除node_modules文件夹,让它重新运行。那我就一直搞错了。我试着搜索错误信息,但是找不到相关的信息。请帮助,因为这是我的唯一的开发服务器。;p

更新:我在运行cloudshell weilies@cloudshell:~/app/airworkz$ npm安装时出错

代码语言:javascript
运行
复制
> fibers@3.1.0 install /home/weilies/apps/airworkz/node_modules/fibers
> node build.js || nodejs build.js

make: Entering directory '/home/weilies/apps/airworkz/node_modules/fibers/build'
  CXX(target) Release/obj.target/fibers/src/fibers.o
../src/fibers.cc:68:2: error: ‘Handle’ does not name a type; did you mean ‘rand_r’?
  Handle<String> NewLatin1String(Isolate* isolate, const char* string) {
  ^~~~~~
  rand_r
../src/fibers.cc:72:2: error: ‘Handle’ does not name a type; did you mean ‘rand_r’?
  Handle<String> NewLatin1Symbol(Isolate* isolate, const char* string) {
  ^~~~~~
  rand_r
../src/fibers.cc:94:2: error: ‘Handle’ does not name a type; did you mean ‘rand_r’?
  Handle<Object> NewInstance(Isolate* isolate, Local<Function> fn, int argc, Local<Value> argv[]) {
  ^~~~~~
  rand_r
../src/fibers.cc:104:2: error: ‘Handle’ does not name a type; did you mean ‘rand_r’?
  Handle<Number> ToNumber(Local<Value> value) {
  ^~~~~~
  rand_r
../src/fibers.cc:114:50: error: ‘Handle’ has not been declared
  Local<Value> GetStackTrace(TryCatch* try_catch, Handle<Context> context) {
                                                  ^~~~~~
../src/fibers.cc:114:56: error: expected ‘,’ or ‘...’ before ‘<’ token
  Local<Value> GetStackTrace(TryCatch* try_catch, Handle<Context> context) {
                                                        ^
../src/fibers.cc: In function ‘v8::Local<v8::Value> uni::GetStackTrace(uni::TryCatch*, int)’:
../src/fibers.cc:115:32: error: ‘context’ was not declared in this scope
   return try_catch->StackTrace(context).ToLocalChecked();
... and many more errors, then end with lines below...
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
node-gyp exited with code: 1
Please make sure you are using a supported platform and node version. If you
would like to compile fibers on this machine please make sure you have setup your
build environment--
Windows + OS X instructions here: https://github.com/nodejs/node-gyp
Ubuntu users please run: `sudo apt-get install g++ build-essential`
RHEL users please run: `yum install gcc-c++` and `yum groupinstall 'Development Tools'`
Alpine users please run: `sudo apk add python make g++`
sh: nodejs: command not found
npm WARN @angular/animations@11.0.8 requires a peer of @angular/core@11.0.8 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/fire@6.0.2 requires a peer of @angular/common@^9.0.0 || ^10.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/fire@6.0.2 requires a peer of @angular/core@^9.0.0 || ^10.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/fire@6.0.2 requires a peer of @angular/platform-browser@^9.0.0 || ^10.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/fire@6.0.2 requires a peer of @angular/platform-browser-dynamic@^9.0.0 || ^10.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/forms@11.0.8 requires a peer of @angular/core@11.0.8 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/forms@11.0.8 requires a peer of @angular/common@11.0.8 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/platform-browser@11.0.8 requires a peer of @angular/core@11.0.8 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/platform-browser@11.0.8 requires a peer of @angular/common@11.0.8 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/platform-browser-dynamic@11.0.8 requires a peer of @angular/core@11.0.8 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/platform-browser-dynamic@11.0.8 requires a peer of @angular/common@11.0.8 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/router@11.0.8 requires a peer of @angular/core@11.0.8 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/router@11.0.8 requires a peer of @angular/common@11.0.8 but none is installed. You must install peer dependencies yourself.
npm WARN ngx-webstorage@5.0.0 requires a peer of @angular/common@^9.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN ngx-webstorage@5.0.0 requires a peer of @angular/core@^9.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN ngx-webstorage@5.0.0 requires a peer of tslib@^1.10.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules/karma/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.3 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules/watchpack/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/webpack-dev-server/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/watchpack-chokidar2/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! fibers@3.1.0 install: `node build.js || nodejs build.js`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the fibers@3.1.0 install 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!     /home/weilies/.npm/_logs/2021-02-06T00_45_14_687Z-debug.log

我还上传了生成的日志文件https://drive.google.com/file/d/1l4m8oLZtxN60wAyfEyQ3TItrEQ55D266/view?usp=sharing

我尝试了一些在net中找到的方法,npm缓存干净,然后npm安装-缓存,但仍然回到相同的错误:(

EN

回答 2

Stack Overflow用户

发布于 2021-02-05 17:23:03

由于node_modules的删除,您无法运行该应用程序。

尝试在命令行中运行:

代码语言:javascript
运行
复制
npm install

然后重新运行应用程序:

代码语言:javascript
运行
复制
ng serve -o
票数 0
EN

Stack Overflow用户

发布于 2021-02-07 02:23:06

(解决了)我最终创建了一个空白的新的角度项目,粘贴在通用的package.json文件中,然后每次运行ng serve -o,让系统突出显示缺少的模块,逐个构建.这很痛苦,但很管用!

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/66067624

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档