以下是我用来上传文件的代码:
java.io.IOException: Permission denied
at java.io.UnixFileSystem.createFileExclusively(Native Method)
at java.io.File.createNewFile(File.java:1012)
答案 0 :(得分:1)
使用命令
更改目录的权限// Note: I noticed that you imported Component from the wrong place. That might also be contributing to your issue so I fixed it here.
import React, { Component } from 'react';
import Relay, {
Route,
RootContainer,
DefaultNetworkLayer
} from 'react-relay'
// Relay.injectNetworkLayer(new DefaultNetworkLayer('http://localhost:3000/graphiql'))
class UserRoute extends Route {
static paramDefinitions = {
userID: { required: true }
}
static queries = {
user: () => Relay.QL`
query {
user(id: $userID)
}
`
}
static routeName = 'UserRoute'
}
class UserInfo extends Component {
render () {
const user = this.props.user
return (
<Text>email: {user.email}</Text>
)
}
}
UserInfo = Relay.createContainer(UserInfo, {
fragments: {
user: () => Relay.QL`
fragment on User {
id,
email
}
`
}
})
class RelayApp extends Component {
render () {
return (
<View style={styles.container}>
<Text style={styles.welcome}>
Welcome to React Native!
</Text>
<Text style={styles.instructions}>
To get started, edit index.ios.js
</Text>
<Text style={styles.instructions}>
Press Cmd+R to reload,{'\n'}
Cmd+D or shake for dev menu
</Text>
<RootContainer
Component={UserInfo}
route={new UserRoute({userID: '1'})}
renderFetched={(data) => <UserInfo {...this.props} {...data} />}
/>
</View>
)
}
}
如果您还想更改子目录的权限
否则
chmod -R 777 <path>
答案 1 :(得分:0)
您需要为文件创建的路径设置正确的权限。您只需为该文件夹设置777文件权限,但这不是正确的方法。首先,你必须检查运行用户的程序&amp;根据该用户,您必须为该目录设置正确的权限。
答案 2 :(得分:0)
您的文件无权打开。 你可以通过这样做来改变它。
chmod +rwx filename