firebase部署错误:“eslint不被识别为内部或外部命令、可操作程序或批处理文件”

Som*_*mto 6 windows-7-x64 npm eslint firebase-hosting firebase-cli

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

\n
    \xe2\x86\x90[33m>\xe2\x86\x90[39m firebase deploy\n\n    === Deploying to 'firebase-project-id'...\n\n    i  deploying database, storage, firestore, functions, hosting\n    Running command: npm --prefix "$RESOURCE_DIR" run lint\n\n    > functions@ lint C:\\Users\\somto\\Desktop\\xampp3\\htdocs\\firebaseProjectFolder\\functions\n    > eslint .\n\n    'eslint' is not recognized as an internal or external command,\n    operable program or batch file.\n    npm ERR! code ELIFECYCLE\n    npm ERR! errno 1\n    npm ERR! functions@ lint: `eslint .`\n    npm ERR! Exit status 1\n    npm ERR!\n    npm ERR! Failed at the functions@ lint script.\n    npm ERR! This is probably not a problem with npm. There is likely additional logging output above.\n\n    npm ERR! A complete log of this run can be found in:\n    npm ERR!     C:\\Users\\somto\\AppData\\Roaming\\npm-cache\\_logs\\2020-08-09T08_37_19_\n    192Z-debug.log\n    events.js:292\n    throw er; // Unhandled 'error' event\n  ^\n\n   Error: spawn npm --prefix "%RESOURCE_DIR%" run lint ENOENT\n   at notFoundError (C:\\Users\\somto\\.cache\\firebase\\tools\\lib\\node_modules\\cros\n   s-env\\node_modules\\cross-spawn\\lib\\enoent.js:6:26)\n   at verifyENOENT (C:\\Users\\somto\\.cache\\firebase\\tools\\lib\\node_modules\\cross\n   -env\\node_modules\\cross-spawn\\lib\\enoent.js:40:16)\n   at ChildProcess.cp.emit (C:\\Users\\somto\\.cache\\firebase\\tools\\lib\\node_modul\n   es\\cross-env\\node_modules\\cross-spawn\\lib\\enoent.js:27:25)\n   at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)\n   Emitted 'error' event on ChildProcess instance at:\n   at ChildProcess.cp.emit (C:\\Users\\somto\\.cache\\firebase\\tools\\lib\\node_modul\n   es\\cross-env\\node_modules\\cross-spawn\\lib\\enoent.js:30:37)\n   at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12) {\n   code: 'ENOENT',\n   errno: 'ENOENT',\n   syscall: 'spawn npm --prefix "%RESOURCE_DIR%" run lint',\n   path: 'npm --prefix "%RESOURCE_DIR%" run lint',\n   spawnargs: []\n   }\n\n   Error: functions predeploy error: Command terminated with non-zero exit code1\n
Run Code Online (Sandbox Code Playgroud)\n

我尝试像这样在全球范围内安装 eslint

\n
   npm install -g install eslint\n
Run Code Online (Sandbox Code Playgroud)\n

即使在本地也是这样

\n
   npm install eslint -save-dev\n
Run Code Online (Sandbox Code Playgroud)\n

我得到了这个错误

\n
   \xe2\x86\x90[33m>\xe2\x86\x90[39m npm install eslint -save-dev\n   npm WARN tar EPERM: operation not permitted, open 'C:\\Users\\somto\\Desktop\\xampp3\n   \\htdocs\\firebaseFocalSells\\functions\\node_modules\\.staging\\emoji-regex-4cb87742\\\n   LICENSE-MIT.txt'\n   npm WARN tar EPERM: operation not permitted, open 'C:\\Users\\somto\\Desktop\\xampp3\n   \\htdocs\\firebaseFocalSells\\functions\\node_modules\\.staging\\mkdirp-b8ac9146\\bin\\u\n   sage.txt'\n   npm WARN tar EPERM: operation not permitted, open 'C:\\Users\\somto\\Desktop\\xampp3\n   \\htdocs\\firebaseFocalSells\\functions\\node_modules\\.staging\\path-is-inside-4de37f\n   7b\\LICENSE.txt'\n   npm WARN tar EPERM: operation not permitted, open 'C:\\Users\\somto\\Desktop\\xampp3\n   \\htdocs\\firebaseFocalSells\\functions\\node_modules\\.staging\\tslib-b2cb758c\\Copyri\n   ghtNotice.txt'\n   npm WARN tar EPERM: operation not permitted, open 'C:\\Users\\somto\\Desktop\\xampp3\n   \\htdocs\\firebaseFocalSells\\functions\\node_modules\\.staging\\mute-stream-a7e5c2a3\\\n   coverage\\lcov-report\\sort-arrow-sprite.png'\n   npm WARN tar EPERM: operation not permitted, open 'C:\\Users\\somto\\Desktop\\xampp3\n   \\htdocs\\firebaseFocalSells\\functions\\node_modules\\.staging\\tslib-b2cb758c\\LICENS\n   E.txt'\n   npm WARN tar EPERM: operation not permitted, open 'C:\\Users\\somto\\Desktop\\xampp3\n   \\htdocs\\firebaseFocalSells\\functions\\node_modules\\.staging\\signal-exit-b8765d91\\\n   LICENSE.txt'\n   npm WARN tar EPERM: operation not permitted, open 'C:\\Users\\somto\\Desktop\\xampp3\n   \\htdocs\\firebaseFocalSells\\functions\\node_modules\\.staging\\punycode-13837a7e\\LIC\n   ENSE-MIT.txt'\n   npm WARN tar EPERM: operation not permitted, open 'C:\\Users\\somto\\Desktop\\xampp3\n   \\htdocs\\firebaseFocalSells\\functions\\node_modules\\.staging\\esquery-038cd083\\lice\n   nse.txt'\n   npm WARN tar EPERM: operation not permitted, open 'C:\\Users\\somto\\Desktop\\xampp3\n   \\htdocs\\firebaseFocalSells\\functions\\node_modules\\.staging\\eslint-49825a49\\messa\n   ges\\all-files-ignored.txt'\n  npm WARN tar EPERM: operation not permitted, open 'C:\\Users\\somto\\Desktop\\xampp3\n  \\htdocs\\firebaseFocalSells\\functions\\node_modules\\.staging\\eslint-49825a49\\messa\n  ges\\extend-config-missing.txt'\n  npm WARN tar EPERM: operation not permitted, open 'C:\\Users\\somto\\Desktop\\xampp3\n  \\htdocs\\firebaseFocalSells\\functions\\node_modules\\.staging\\eslint-49825a49\\messa\n  ges\\failed-to-read-json.txt'\n  npm WARN tar EPERM: operation not permitted, open 'C:\\Users\\somto\\Desktop\\xampp3\n  \\htdocs\\firebaseFocalSells\\functions\\node_modules\\.staging\\eslint-49825a49\\messa\n  ges\\file-not-found.txt'\n  npm WARN tar EPERM: operation not permitted, open 'C:\\Users\\somto\\Desktop\\xampp3\n  \\htdocs\\firebaseFocalSells\\functions\\node_modules\\.staging\\eslint-49825a49\\messa\n  ges\\no-config-found.txt'\n  npm WARN tar EPERM: operation not permitted, open 'C:\\Users\\somto\\Desktop\\xampp3\n  \\htdocs\\firebaseFocalSells\\functions\\node_modules\\.staging\\eslint-49825a49\\messa\n  ges\\plugin-missing.txt'\n  npm WARN tar EPERM: operation not permitted, open 'C:\\Users\\somto\\Desktop\\xampp3\n  \\htdocs\\firebaseFocalSells\\functions\\node_modules\\.staging\\eslint-49825a49\\messa\n  ges\\whitespace-found.txt'\n  npm WARN tar EPERM: operation not permitted, open 'C:\\Users\\somto\\Desktop\\xampp3\n  \\htdocs\\firebaseFocalSells\\functions\\node_modules\\.staging\\rxjs-d9c29a17\\_esm201\n  5\\LICENSE.txt'\n npm ERR! cb() never called!\n\n npm ERR! This is an error with npm itself. Please report this error at:\n npm ERR!     <https://npm.community>\n\n npm ERR! A complete log of this run can be found in:\n npm ERR!     C:\\Users\\somto\\AppData\\Roaming\\npm-cache\\_logs\\2020-08-09T08_06_37_\n 190Z-debug.log\n
Run Code Online (Sandbox Code Playgroud)\n

我也尝试过这个

\n
   npm -g i eslint-cli\n
Run Code Online (Sandbox Code Playgroud)\n

并得到已经存在的错误

\n

请问,我该如何解决此问题?\n我使用的是 Windows 7

\n

Mr.*_*Mr. 2

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

npm install eslint -save-dev
Run Code Online (Sandbox Code Playgroud)

使用

npm install eslint --save-dev
Run Code Online (Sandbox Code Playgroud)

这可能是问题所在:)