npm - firebase 部署错误 : 'eslint is not recognized as an internal or external command, operable program or batch file'

标签 npm eslint windows-7-x64 firebase-hosting firebase-cli

我想使用 firebase 托管。所以我按照文档中的说明安装 firebase cli ...我尝试部署并收到此错误

    ←[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
   npm install -g install eslint
即使在本地也是这样
   npm install eslint -save-dev
我收到了这个错误
   ←[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
我也试过这个
   npm -g i eslint-cli
并且已经存在错误
请问,我该如何解决这个问题?
我正在使用 Windows 7

最佳答案

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

npm install eslint -save-dev

利用
npm install eslint --save-dev
这可能是问题:)

关于npm - firebase 部署错误 : 'eslint is not recognized as an internal or external command, operable program or batch file' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63324612/

相关文章:

node.js - Npm 测试找不到 socket.io.js 文件

node.js - 有没有办法解决这个 "npm install"问题?

javascript - 将函数输入限制为给定的正则表达式格式

javascript - 找不到已发布的 React 组件模块

Angular 9 + eslint : error Definition for rule '@angular-eslint/...' was not found

javascript - 解构和克隆对象/一行?

reactjs - 文件/Blob - eslint(no-undef)

python - 在 Windows 7 中使用路径扩展\\?\和 python 脚本

python - 无法从 PyQt4 导入 QtCore 或 QtGui

c++ - 使文件在Windows中可写