简体   繁体   English

在Firebase上部署React应用程序时,“ EACCES:权限被拒绝”

[英]“EACCES: permission denied” when deploying a React app on Firebase

I'm currently following Tyler McGinnis Tutorial and I'm having some issues trying to deploy the app to Firebase. 我目前正在关注Tyler McGinnis教程,并且在尝试将应用程序部署到Firebase时遇到一些问题。

I've installed firebase-tools locally ( npm install --save-dev firebase-tools ) to allow me to host the app and added a couple of scripts in my package.json. 我已经在本地安装了firebase-tools( npm install --save-dev firebase-tools ),以允许我托管该应用,并在package.json中添加了两个脚本。

I'm using npm 3.10.10 and node v6.11.0 我正在使用npm 3.10.10和节点v6.11.0

Here's my package.json: 这是我的package.json:

    {
      "name": "github-battle",
      "version": "1.0.0",
      "description": "",
      "main": "index.js",
      "scripts": {
        "start": "webpack-dev-server --open",
        "build": "NODE_ENV='production' webpack -p",
        "firebase-init": "firebase login && firebase init",
        "deploy": "npm run build && firebase deploy"
      },
      "babel": {
        "presets": [
          "env",
          "react"
        ]
      },
      "author": "",
      "license": "ISC",
      "dependencies": {
        "axios": "^0.16.2",
        "query-string": "^4.3.4",
        "react": "^15.6.1",
        "react-dom": "^15.6.1",
        "react-router-dom": "^4.1.2"
      },
      "devDependencies": {
        "babel-core": "^6.25.0",
        "babel-loader": "^7.1.1",
        "babel-preset-env": "^1.5.2",
        "babel-preset-react": "^6.24.1",
        "css-loader": "^0.28.4",
        "firebase-tools": "^3.9.1",
        "html-webpack-plugin": "^2.29.0",
        "style-loader": "^0.18.2",
        "webpack": "^3.0.0",
        "webpack-dev-server": "^2.5.0"
      }
    }

And my webpack.config.js: 而我的webpack.config.js:

var path = require('path');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var webpack = require('webpack');

var config = {
  entry: './app/index.js',
  output: {
    path: path.resolve(__dirname, 'dist'),
    filename: 'index_bundle.js',
    publicPath: '/'
  },
  module: {
    rules: [
      { test: /\.(js)$/, use: 'babel-loader' },
      { test: /\.css$/, use: [ 'style-loader', 'css-loader' ]}
    ]
  },
  devServer: {
    historyApiFallback: true,
  },
  plugins: [
    new HtmlWebpackPlugin({
      template: 'app/index.html'
    })
  ]
};

if (process.env.NODE_ENV === 'production') {
  config.plugins.push(
    new webpack.DefinePlugin({
      'process.env': {
        'NODE_ENV': JSON.stringify(process.env.NODE_ENV)
      }
    }),
    new webpack.optimize.UglifyJsPlugin()
  )
}

module.exports = config;

And when running npm run firebase-init I get the following error stack: 当运行npm run firebase-init ,出现以下错误堆栈:

Error: EACCES: permission denied, open '/Users/carlosgrijalva/.config/configstore/update-notifier-firebase-tools.json'
You don't have access to this file.

    at Error (native)
    at Object.fs.openSync (fs.js:641:18)
    at Object.fs.readFileSync (fs.js:509:33)
    at Object.get (/Users/carlosgrijalva/Code/github-battle/node_modules/configstore/index.js:34:26)
    at Object.Configstore (/Users/carlosgrijalva/Code/github-battle/node_modules/configstore/index.js:27:44)
    at new UpdateNotifier (/Users/carlosgrijalva/Code/github-battle/node_modules/update-notifier/index.js:34:17)
    at module.exports (/Users/carlosgrijalva/Code/github-battle/node_modules/update-notifier/index.js:123:23)
    at Object.<anonymous> (/Users/carlosgrijalva/Code/github-battle/node_modules/firebase-tools/bin/firebase:5:48)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)

npm ERR! Darwin 16.6.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "firebase-init"
npm ERR! node v6.11.0
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! github-battle@1.0.0 firebase-init: `firebase login && firebase init`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the github-battle@1.0.0 firebase-init script 'firebase login && firebase init'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the github-battle package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     firebase login && firebase init
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs github-battle
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls github-battle
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/carlosgrijalva/Code/github-battle/npm-debug.log

Not really sure if the problem lies in the versions i'm using... Any suggestions? 不太确定问题是否出在我使用的版本中...有什么建议吗?

If you are on mac or linux, prefix your command with sudo . 如果您使用的是Mac或Linux,请在命令前添加sudo
If you are on windows, run the command prompt as administrator. 如果您在Windows上,请以管理员身份运行命令提示符。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 EACCES:权限被拒绝,处于打开状态 - EACCES: permission denied, open Errno :: EACCES:运行bundle时权限被拒绝,它命中json 1.8.1,pg 0.17 - Errno::EACCES: Permission denied when running bundle and it hits json 1.8.1, pg 0.17 Firebase数据库上的权限被拒绝 - permission denied on firebase database 错误消息“java.net.SocketException:套接字失败:EACCES(权限被拒绝)” - Error message 'java.net.SocketException: socket failed: EACCES (Permission denied)' Firebase JSON访问权限被拒绝,即使已经使用Firebase Auth登录 - Firebase JSON access permission denied even already login with Firebase Auth 将JSON文件用作Kivy应用程序中的存储时,对.json文件的权限被拒绝 - Permission denied to .json file when using a JSON file as a store in Kivy app 即使在用户身份验证后,Android默认Firebase权限也被拒绝 - Android default Firebase Permission denied even after user Authenticated Firebase服务帐户凭据Json读取权限被拒绝 - Firebase Service Account Credentials Json Read permission denied 在Firebase上部署WebApp时发生意外错误 - Unexpected error when deploying webapp on firebase 当我执行 npm install 时,Git Clone 的权限被拒绝 - Permission denied for Git Clone when I do npm install
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM