After creating a project with NPX create nuxt app MT app in the video, you can’t use import… From. Follow the teacher to modify the file in webpack.js. Amend as follows
"scripts": {
"dev": "cross-env NODE_ENV=development nodemon server/index.js --watch server --exec babel-node", //修改内容 --exec babel-node
"build": "nuxt build",
"start": "cross-env NODE_ENV=production node server/index.js --exec babel-node",//修改内容 --exec babel-node
"generate": "nuxt generate"
},
Next, create a. Babeltc file in the project directory. The file configuration is as follows
{
"presets": ["es2015"]
}
Then install NPM install babel-preset-es2015 and run it with an error
$ npm run dev
> [email protected] dev D:\text\vue\mt-app
> cross-env NODE_ENV=development nodemon --exec babel-node server/index.js --watch server
[nodemon] 1.19.1
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: D:\text\vue\mt-app\server/**/*
[nodemon] starting `babel-node server/index.js`
'babel-node' ▒▒▒▒▒ڲ▒▒▒▒ⲿ▒▒▒Ҳ▒▒▒ǿ▒▒▒▒еij▒▒▒
▒▒▒▒▒▒▒▒▒ļ▒▒▒
[nodemon] app crashed - waiting for file changes before starting...
Solution:
Two other Babel cores and Babel CLIS need to be installed during installation, namely NPMI Babel core Babel preset es2015 Babel CLIS
Problem solving