我正在使用cloud9帐户进行项目。我的朋友在React和节点中完成了一半的工作,我必须在自动消息和Nodejs中的电子邮件提取中做其他工作。我从朋友的Git-hub存储库中克隆了该项目。我的问题是,在我的cloud9终端中,它表示没有找到reaact脚本,因为在我的package.json文件中存在所有包和dev依赖项。如果有人拥有cloud9帐号,请告诉我们!我正在分享我的代码。我对任何反应都没有任何想法,如果有人能够解释,这将是一个很大的帮助。
// package.json
{
"name": "mernstack",
"version": "1.0.0",
"description": "",
"main": "index.js",
"engines": {
"node": "8.1.1",
"npm": "5.0.3"
},
"scripts": {
"start": "node index.js",
"mernstack": "nodemon index.js",
"client": "npm run start --prefix client",
"dev": "concurrently \"npm run mernstack\" \"npm run client\"",
"heroku-postbuild": "NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client"
},
"author": "",
"license": "ISC",
"dependencies": {
"babel-loader": "^7.1.4",
"babel-preset-es2015": "^6.24.1",
"babel-preset-react": "^6.24.1",
"babel-preset-stage-1": "^6.24.1",
"body-parser": "^1.18.3",
"concurrently": "^3.5.1",
"connect-mongo": "^2.0.1",
"cookie-parser": "^1.4.3",
"cookie-session": "^2.0.0-beta.3",
"express": "^4.16.3",
"express-session": "^1.15.6",
"heroku-cli": "^7.0.9",
"history": "^4.7.2",
"materialize-css": "^1.0.0-rc.1",
"mongoose": "^5.0.17",
"nodemon": "^1.17.3",
"passport": "^0.4.0",
"passport-google-oauth20": "^1.0.0",
"react-image-lightbox": "^5.0.0",
"redux-logger": "^3.0.6",
"webpack": "^4.12.0",
"webpack-cli": "^2.1.5"
},
"devDependencies": {
"babel-core": "^6.26.3",
"babel-loader": "^7.1.4",
"html-webpack-plugin": "^3.2.0",
"webpack": "^4.11.0",
"webpack-cli": "^2.1.3",
"webpack-dev-server": "^3.1.4"
},
"/auth/google/callback": {
"target": "http://localhost:5000"
}
}
//authRoutes
const passport = require('passport');
const keys = require('../config/keys');
module.exports = (app) => {
//route handler
app.get(
'/auth/google',
passport.authenticate('google', {
//scope used to know what access you want to have in google
scope: ['profile','email']
})
);
//2nd route handler to exchange the code with actual profile and email
app.get('/auth/google/callback'
,passport.authenticate('google'),
(req,res) => {
res.redirect(keys.hostKey + '/restaurantsearch');
}
);
app.get('/api/logout',(req,res) => {
req.logout();
res.redirect('/')
}
);
app.get('/api/current_user',(req,res) => {
res.send(req.user);
})
};
// passport.js
const passport = require('passport');
const GoogleStrategy = require('passport-google-oauth20').Strategy;
const mongoose = require('mongoose');
const keys = require('../config/keys');
const User = mongoose.model('users');
passport.serializeUser((user,done) => {
done(null,user.id);
});
passport.deserializeUser((id,done) => {
User.findById(id).then(user => {
done(null,user);
});
});
//Use instance of passport to authenticate a specific kind of Strategy
passport.use(new GoogleStrategy({
clientID: keys.googleClientID,
clientSecret: keys.googleClientSecret,
callbackURL: '/auth/google/callback',
proxy: true
},
function(accessToken, refreshToken, profile, cb) {
User.findOrCreate({ googleId: profile.id }, function (err, user) {
return cb(err, user);
});
}
)
);
when i run the command npm run dev it shows error ! Click this