每个人。我尝试从https://github.com/crsandeep/simple-react-full-stack部署Reack全栈应用 而且它不起作用。我读了太多有关部署对gcloud做出反应的文章,但是有简单的应用程序,而不是全栈应用程序。
我的packege.json,我从git那里获取的
public partial class MainWindow : Window {
public MainWindow() {
InitializeComponent();
ObservableCollection<bool> states = new ObservableCollection<bool> { false, false, false };
states.CollectionChanged += States_CollectionChanged;
DataContext = states;
}
private void States_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) {
var collection = sender as ObservableCollection<bool>;
if (e.Action == NotifyCollectionChangedAction.Replace) {
if ((bool)e.NewItems[0]) {
for (int i = 0; i < collection.Count; i++) {
if (e.NewStartingIndex != i) {
collection[i] = false;
}
}
}
}
}
}
我的app.yaml是我从Google那里获取的
{
"name": "simple-react-full-stack",
"version": "1.0.0",
"description": "Boilerplate to build a full stack web application using React, Node.js, Express and Webpack.",
"main": "src/server/index.js",
"scripts": {
"build": "webpack --mode production",
"start": "npm run build && node src/server/index.js",
"client": "webpack-dev-server --mode development --devtool inline-source-map --hot",
"server": "nodemon src/server/index.js",
"dev": "concurrently \"npm run server\" \"npm run client\""
},
"author": "Sandeep Raveesh",
"license": "ISC",
"dependencies": {
"babel-polyfill": "^6.26.0",
"express": "^4.16.3",
"react": "^16.5.2",
"react-dom": "^16.5.2"
},
"devDependencies": {
"@babel/core": "^7.0.0",
"@babel/plugin-proposal-class-properties": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"@babel/preset-react": "^7.0.0",
"babel-eslint": "^10.0.0",
"babel-loader": "^8.0.0",
"clean-webpack-plugin": "^1.0.0",
"concurrently": "^4.0.0",
"css-loader": "^2.0.0",
"eslint": "^5.0.0",
"eslint-config-airbnb": "^17.0.0",
"eslint-plugin-import": "^2.11.0",
"eslint-plugin-jsx-a11y": "^6.0.3",
"eslint-plugin-react": "^7.7.0",
"file-loader": "^3.0.0",
"html-webpack-plugin": "^3.2.0",
"nodemon": "^1.17.3",
"style-loader": "^0.23.0",
"url-loader": "^1.0.1",
"webpack": "^4.5.0",
"webpack-cli": "^3.0.8",
"webpack-dev-server": "^3.1.3"
}
}
我在码头跑
env: flex
runtime: nodejs
我有错
gcloud beta app deploy
我不明白它的需要,我试图添加“ npm install”,但它也无法正常工作。 如何解决?
答案 0 :(得分:0)
这里是一个community tutorial,您可以按照其操作,按照说明先进行操作,然后开始进行所需的编辑。
请确保您正在执行“ Preparing the app”部分中的步骤,因为您似乎缺少上述步骤。
npm init
npm install --save webpack express pug
以及将package.json修改为包括:
"scripts": {
"bundle": "webpack --config webpack.config.js",
"prestart": "npm run bundle"
}
还请注意:
Webpack必须列在package.json文件的依赖项中, 因为默认情况下,当应用程序处于 部署到Google App Engine。
还请记住,gcloud beta app deploy
仍在 BETA 中,并且可能会有更改,恕不另行通知。因此,对于您要实现的目标,无需使用beta。只需使用gcloud app deploy
。