我已经尝试了github和stackoverflow中的所有方法,但无法解决, 使用
运行项目后npm run dev
总是说
Babel compilation error TypeError: Cannot read property 'bindings' of null
下面是我的代码
.babelrc =>
{
"presets":["env"],
/*"presets": ["@babel/preset-env"]*/
}
package.json =>
{
"name": "backend",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"dev": "babel-watch server.js"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"@babel/preset-env": "^7.4.5",
"babel-cli": "^6.26.0",
"babel-preset-env": "^1.7.0",
"babel-watch": "^7.0.0"
},
"dependencies": {
"@babel/core": "^7.4.5",
"babel": "^6.23.0",
"cors": "^2.8.5",
"express": "^4.17.1",
"mongoose": "^5.5.12"
}
}
server.js =>
import express from 'express';
import cors from 'cors';
import bodyParser from 'body-parser';
import mongoose from 'mongoose';
const app = express();
app.get('/',(req,res) => res.send('Hello world!'));
app.listen(4000,()=>console.log('Express server running on port 4000'));
请帮助我