简体   繁体   中英

“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.

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.

I'm using npm 3.10.10 and node v6.11.0

Here's my 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:

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:

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 .
If you are on windows, run the command prompt as administrator.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM