运行命令“ npm install --save firebase”时出现以下错误
fsevents@1.2.4 install /Users/narenpalep/Desktop/Angular:AngularJS/Angular2/firebase-demo/node_modules/fsevents
> node install
node-pre-gyp WARN Tried to download(404): https://fsevents-binaries.s3-us-west-2.amazonaws.com/v1.2.4/fse-v1.2.4-node-v67-darwin-x64.tar.gz
node-pre-gyp WARN Pre-built binaries not found for fsevents@1.2.4 and node@11.2.0 (node-v67 ABI, unknown) (falling back to source compile with node-gyp)
action_after_build.target.mk:6: *** target pattern contains no `%'. Stop.
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:182:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:254:12)
gyp ERR! System Darwin 18.2.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/Users/narenpalep/Desktop/Angular:AngularJS/Angular2/firebase-demo/node_modules/fsevents/lib/binding/Release/node-v67-darwin-x64/fse.node" "--module_name=fse" "--module_path=/Users/narenpalep/Desktop/Angular:AngularJS/Angular2/firebase-demo/node_modules/fsevents/lib/binding/Release/node-v67-darwin-x64" "--napi_version=3""--node_abi_napi=napi"
gyp ERR! cwd /Users/narenpalep/Desktop/Angular:AngularJS/Angular2/firebase-demo/node_modules/fsevents
gyp ERR! node -v v11.2.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/Users/narenpalep/Desktop/Angular:AngularJS/Angular2/firebase-demo/node_modules/fsevents/lib/binding/Release/node-v67-darwin-x64/fse.node --module_name=fse --module_path=/Users/narenpalep/Desktop/Angular:AngularJS/Angular2/firebase-demo/node_modules/fsevents/lib/binding/Release/node-v67-darwin-x64--napi_version=3 --node_abi_napi=napi' (1)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/Users/narenpalep/Desktop/Angular:AngularJS/Angular2/firebase-demo/node_modules/fsevents/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:182:13)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:978:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:265:5)
node-pre-gyp ERR! System Darwin 18.2.0
node-pre-gyp ERR! command "/usr/local/bin/node" "/Users/narenpalep/Desktop/Angular:AngularJS/Angular2/firebase-demo/node_modules/fsevents/node_modules/node-pre-gyp/bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /Users/narenpalep/Desktop/Angular:AngularJS/Angular2/firebase-demo/node_modules/fsevents
node-pre-gyp ERR! node -v v11.2.0
node-pre-gyp ERR! node-pre-gyp -v v0.10.0
node-pre-gyp ERR! not ok
Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/Users/narenpalep/Desktop/Angular:AngularJS/Angular2/firebase-demo/node_modules/fsevents/lib/binding/Release/node-v67-darwin-x64/fse.node --module_name=fse --module_path=/Users/narenpalep/Desktop/Angular:AngularJS/Angular2/firebase-demo/node_modules/fsevents/lib/binding/Release/node-v67-darwin-x64 --napi_version=3 --node_abi_napi=napi' (1)
> grpc@1.16.1 install /Users/narenpalep/Desktop/Angular:AngularJS/Angular2/firebase-demo/node_modules/grpc
> node-pre-gyp install --fallback-to-build --library=static_library
sh: node-pre-gyp: command not found
npm WARN @angular/fire@5.1.1 requires a peer of @angular/common@>=6.0.0 <8 butnone is installed. You must install peer dependencies yourself.
npm WARN @angular/fire@5.1.1 requires a peer of @angular/core@>=6.0.0 <8 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/fire@5.1.1 requires a peer of @angular/platform-browser@>=6.0.0 <8 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/fire@5.1.1 requires a peer of @angular/platform-browser-dynamic@>=6.0.0 <8 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/fire@5.1.1 requires a peer of rxjs@^6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules/fsevents):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 install: `node install`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! grpc@1.16.1 install: `node-pre-gyp install --fallback-to-build --library=static_library`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the grpc@1.16.1 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! /Users/narenpalep/.npm/_logs/2018-12-08T07_31_54_719Z-debug.log
and when I do "ng serve" later I am getting the following error.
ERROR in node_modules/@angular/fire/database/interfaces.d.ts(2,26): error TS2307: Cannot find module 'firebase/app'.
node_modules/@angular/fire/firebase.app.module.d.ts(2,79): error TS2307: Cannot find module 'firebase/app'.
node_modules/@angular/fire/firestore/collection/collection.d.ts(2,27): error TS2307: Cannot find module 'firebase/app'.
node_modules/@angular/fire/firestore/document/document.d.ts(5,27): error TS2307: Cannot find module 'firebase/app'.
node_modules/@angular/fire/firestore/firestore.d.ts(7,27): error TS2307: Cannot find module 'firebase/app'.
node_modules/@angular/fire/firestore/interfaces.d.ts(2,27): error TS2307: Cannot find module 'firebase/app'.
我需要一些帮助来解决上述问题以及造成此问题的原因。我尝试在线搜索并安装了一些其他与google和firebase相关的模块,但问题尚未解决。
答案 0 :(得分:0)
删除~/.node-gyp
和~/.npmrc
目录。另外,在您的项目中删除node_modules
文件夹。
然后在您的项目目录中运行以下命令,
npm install --save firebase