首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >firebase部署错误:未将eslint识别为内部或外部命令、可操作程序或批处理文件

firebase部署错误:未将eslint识别为内部或外部命令、可操作程序或批处理文件
EN

Stack Overflow用户
提问于 2020-08-09 17:21:21
回答 3查看 1.3K关注 0票数 3

我想使用firebase托管。因此,我按照文档中的说明安装了firebase cli...我尝试部署,但得到以下错误

代码语言:javascript
运行
复制
    ←[33m>←[39m firebase deploy

    === Deploying to 'firebase-project-id'...

    i  deploying database, storage, firestore, functions, hosting
    Running command: npm --prefix "$RESOURCE_DIR" run lint

    > functions@ lint C:\Users\somto\Desktop\xampp3\htdocs\firebaseProjectFolder\functions
    > eslint .

    'eslint' is not recognized as an internal or external command,
    operable program or batch file.
    npm ERR! code ELIFECYCLE
    npm ERR! errno 1
    npm ERR! functions@ lint: `eslint .`
    npm ERR! Exit status 1
    npm ERR!
    npm ERR! Failed at the functions@ lint 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\somto\AppData\Roaming\npm-cache\_logs\2020-08-09T08_37_19_
    192Z-debug.log
    events.js:292
    throw er; // Unhandled 'error' event
  ^

   Error: spawn npm --prefix "%RESOURCE_DIR%" run lint ENOENT
   at notFoundError (C:\Users\somto\.cache\firebase\tools\lib\node_modules\cros
   s-env\node_modules\cross-spawn\lib\enoent.js:6:26)
   at verifyENOENT (C:\Users\somto\.cache\firebase\tools\lib\node_modules\cross
   -env\node_modules\cross-spawn\lib\enoent.js:40:16)
   at ChildProcess.cp.emit (C:\Users\somto\.cache\firebase\tools\lib\node_modul
   es\cross-env\node_modules\cross-spawn\lib\enoent.js:27:25)
   at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
   Emitted 'error' event on ChildProcess instance at:
   at ChildProcess.cp.emit (C:\Users\somto\.cache\firebase\tools\lib\node_modul
   es\cross-env\node_modules\cross-spawn\lib\enoent.js:30:37)
   at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12) {
   code: 'ENOENT',
   errno: 'ENOENT',
   syscall: 'spawn npm --prefix "%RESOURCE_DIR%" run lint',
   path: 'npm --prefix "%RESOURCE_DIR%" run lint',
   spawnargs: []
   }

   Error: functions predeploy error: Command terminated with non-zero exit code1

我已经尝试在全局安装eslint,如下所示

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

即使是像这样的地方

代码语言:javascript
运行
复制
   npm install eslint -save-dev

我得到了这个错误

代码语言:javascript
运行
复制
   ←[33m>←[39m npm install eslint -save-dev
   npm WARN tar EPERM: operation not permitted, open 'C:\Users\somto\Desktop\xampp3
   \htdocs\firebaseFocalSells\functions\node_modules\.staging\emoji-regex-4cb87742\
   LICENSE-MIT.txt'
   npm WARN tar EPERM: operation not permitted, open 'C:\Users\somto\Desktop\xampp3
   \htdocs\firebaseFocalSells\functions\node_modules\.staging\mkdirp-b8ac9146\bin\u
   sage.txt'
   npm WARN tar EPERM: operation not permitted, open 'C:\Users\somto\Desktop\xampp3
   \htdocs\firebaseFocalSells\functions\node_modules\.staging\path-is-inside-4de37f
   7b\LICENSE.txt'
   npm WARN tar EPERM: operation not permitted, open 'C:\Users\somto\Desktop\xampp3
   \htdocs\firebaseFocalSells\functions\node_modules\.staging\tslib-b2cb758c\Copyri
   ghtNotice.txt'
   npm WARN tar EPERM: operation not permitted, open 'C:\Users\somto\Desktop\xampp3
   \htdocs\firebaseFocalSells\functions\node_modules\.staging\mute-stream-a7e5c2a3\
   coverage\lcov-report\sort-arrow-sprite.png'
   npm WARN tar EPERM: operation not permitted, open 'C:\Users\somto\Desktop\xampp3
   \htdocs\firebaseFocalSells\functions\node_modules\.staging\tslib-b2cb758c\LICENS
   E.txt'
   npm WARN tar EPERM: operation not permitted, open 'C:\Users\somto\Desktop\xampp3
   \htdocs\firebaseFocalSells\functions\node_modules\.staging\signal-exit-b8765d91\
   LICENSE.txt'
   npm WARN tar EPERM: operation not permitted, open 'C:\Users\somto\Desktop\xampp3
   \htdocs\firebaseFocalSells\functions\node_modules\.staging\punycode-13837a7e\LIC
   ENSE-MIT.txt'
   npm WARN tar EPERM: operation not permitted, open 'C:\Users\somto\Desktop\xampp3
   \htdocs\firebaseFocalSells\functions\node_modules\.staging\esquery-038cd083\lice
   nse.txt'
   npm WARN tar EPERM: operation not permitted, open 'C:\Users\somto\Desktop\xampp3
   \htdocs\firebaseFocalSells\functions\node_modules\.staging\eslint-49825a49\messa
   ges\all-files-ignored.txt'
  npm WARN tar EPERM: operation not permitted, open 'C:\Users\somto\Desktop\xampp3
  \htdocs\firebaseFocalSells\functions\node_modules\.staging\eslint-49825a49\messa
  ges\extend-config-missing.txt'
  npm WARN tar EPERM: operation not permitted, open 'C:\Users\somto\Desktop\xampp3
  \htdocs\firebaseFocalSells\functions\node_modules\.staging\eslint-49825a49\messa
  ges\failed-to-read-json.txt'
  npm WARN tar EPERM: operation not permitted, open 'C:\Users\somto\Desktop\xampp3
  \htdocs\firebaseFocalSells\functions\node_modules\.staging\eslint-49825a49\messa
  ges\file-not-found.txt'
  npm WARN tar EPERM: operation not permitted, open 'C:\Users\somto\Desktop\xampp3
  \htdocs\firebaseFocalSells\functions\node_modules\.staging\eslint-49825a49\messa
  ges\no-config-found.txt'
  npm WARN tar EPERM: operation not permitted, open 'C:\Users\somto\Desktop\xampp3
  \htdocs\firebaseFocalSells\functions\node_modules\.staging\eslint-49825a49\messa
  ges\plugin-missing.txt'
  npm WARN tar EPERM: operation not permitted, open 'C:\Users\somto\Desktop\xampp3
  \htdocs\firebaseFocalSells\functions\node_modules\.staging\eslint-49825a49\messa
  ges\whitespace-found.txt'
  npm WARN tar EPERM: operation not permitted, open 'C:\Users\somto\Desktop\xampp3
  \htdocs\firebaseFocalSells\functions\node_modules\.staging\rxjs-d9c29a17\_esm201
  5\LICENSE.txt'
 npm ERR! cb() never called!

 npm ERR! This is an error with npm itself. Please report this error at:
 npm ERR!     <https://npm.community>

 npm ERR! A complete log of this run can be found in:
 npm ERR!     C:\Users\somto\AppData\Roaming\npm-cache\_logs\2020-08-09T08_06_37_
 190Z-debug.log

我也试过这个

代码语言:javascript
运行
复制
   npm -g i eslint-cli

并获取已存在的错误

我该如何解决这个问题呢?我使用的是windows 7

EN

回答 3

Stack Overflow用户

发布于 2020-08-09 22:12:11

你有一个小小的打字错误。而不是:

npm安装eslint -save-dev

使用

代码语言:javascript
运行
复制
npm install eslint --save-dev

这可能是问题所在:)

票数 2
EN

Stack Overflow用户

发布于 2021-10-03 13:02:33

如果您使用的是firebase函数或项目文件夹,请将目录切换到functions文件夹,并使用npm i安装依赖项。package.json将如下所示:

代码语言:javascript
运行
复制
"devDependencies":
{
    "eslint": "^7.6.0",
    "eslint-config-google": "^0.14.0",
    "firebase-functions-test": "^0.2.0"
}

现在使用npm run build进行构建,使用firebase deploy进行部署。

票数 0
EN

Stack Overflow用户

发布于 2020-12-03 14:51:52

尝试使用以下命令重新初始化firebase

代码语言:javascript
运行
复制
firebase init
票数 -1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/63324612

复制
相关文章

相似问题

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