我正在运行一个git gc --aggressive非常大的回购(apx 100 gb).它已经运行了两个晚上,并且在几个小时之后,它一直被困在:"压缩对象:99%(76496/76777)"
如果我Ctrl- C这个过程,后果是什么?我的回购会无法使用吗?我的直觉说不,但我想要一些意见.谢谢!
我正在尝试使用外部包:
npm install [python-shell][1]
Run Code Online (Sandbox Code Playgroud)
现在,我只有基本的 js 文件和包附带的示例:
console.log('hey in main.js')
var PythonShell = require('python-shell');
PythonShell.run('./my_script.py', function (err) {
if (err) throw err;
console.log('finished running python script');
});
Run Code Online (Sandbox Code Playgroud)
随着my_script.py等
当我启动服务器时,console.log 说:
Uncaught TypeError: spawn is not a function
Run Code Online (Sandbox Code Playgroud)
在 python-shell 包的 index.js 中,正确需要 spawn(类似情况):
var spawn = require('child_process').spawn;
Run Code Online (Sandbox Code Playgroud)
后来,它在包中使用,如下所示:
this.childProcess = spawn(pythonPath, this.command, options);
Run Code Online (Sandbox Code Playgroud)
但是,spawn似乎确实是一个函数:
master$>node
> require('child_process')
{ ChildProcess:
{ [Function: ChildProcess]
super_:
{ [Function: EventEmitter]
EventEmitter: [Circular],
usingDomains: true,
defaultMaxListeners: 10,
init: [Function], …Run Code Online (Sandbox Code Playgroud) 我有一个关于反引号如何在样式组件中工作的问题。
假设我使用它们定义并传递了一个主题ThemeProvider:
const theme = {
primary: '#df0000',
}
ReactDOM.render(
<ThemeProvider theme={theme}>
<App />
</ThemeProvider>
,
document.getElementById('root')
)
Run Code Online (Sandbox Code Playgroud)
我可以定义一个props.theme.primary在 App.js中访问的“样式 Div”,如下所示:
const App = props => {
const Div = styled.div`
background-color: ${props => props.theme.primary};
`
return (
<>
{console.log(props)}
<h1>Welcome to React Parcel Micro App!</h1>
<p>Hard to get more minimal than this React app.</p>
<Div>lol</Div>
</>
)
}
export default App
Run Code Online (Sandbox Code Playgroud)
太好了,除了props.theme只能由 Div 访问,因为它${}在反引号内。console.log(props.theme)说undefined。但是,如果我使用,export default withTheme(App) …
我不能让以下内容在React的工作中 render()
<table>
<tbody>
...
{ this.state.data.map( (entry, index) =>
<tr>{ Object.values(entry).forEach( e => <td>{e}</td> )}</tr>
)}
</tbody>
</table>
Run Code Online (Sandbox Code Playgroud)
但是,当我替换为时<td>{e}</td>,console.log(e)我会看到期望的渲染效果。实际上,任何常规的html元素也不会在forEach方法内部呈现。在React中执行此操作的常用方法是什么?