[nodemon] app crashed - waiting for file changes before starting...

慕课网前端工程师晋升课程 Vue全家桶+SSR+Koa2全栈开发美团网

视频里用 npx create-nuxt-app mt-app创建项目后,不能使用import ...from...。跟着老师修改webpack.js里的文件。修改如下

"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"
},

接着在项目目录创建 .babeltc文件,文件配置如下

{
    "presets": ["es2015"]
}

接着安装  npm install babel-preset-es2015,然后运行时,出现错误

$ npm run dev

> mt-app@1.0.0 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...

解决方法:

安装的时候需要安装另外两个babel-core和babel-cli,即: npm i babel-core babel-preset-es2015 babel-cli

问题解决

posted @ 2019-06-16 11:57  遗失的王者之心  阅读(15759)  评论(0编辑  收藏  举报