npm 缓存问题 - 未重建



我正在使用带有 vue 的 Laravel 5.4.js .然后我在创建和方法之间出现了语法错误。我忘了,然后我修复了这个错误。

但错误仍在继续。

<script>
export default {
data(){
return {
users: []
}
},
created(){
this.fetchUsers();
},//forgotten
methods:{ //41.line
fetchUsers(){
this.$http.get('/users').then(response => {
this.users = response.data.users;
});
}
}
}
</script>

我重新启动了阿帕奇。但是如果我写"npm run dev"或"npm run watch",仍然会出现此错误。

error  in ./resources/assets/js/components/Users.vue
Syntax Error: Unexpected token, expected , (41:4)
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! @ development: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the @ development script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR!     /home/ubuntu/.npm/_logs/2017-07-11T08_13_41_572Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! @ dev: `npm run development`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the @ dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR!     /home/ubuntu/.npm/_logs/2017-07-11T08_13_41_618Z-debug.log

编辑

我听你的建议并申请。我的意思是问题不是相关的语法错误。问题是旧代码执行新代码。我保存了所有文件,然后保存了"npm run dev",但每次都返回相同的错误。

即使我也得到了相同的error- A这次运行的完整日志可以在以下位置找到: 问题出在端口号上,转到package.json文件并将端口号更改为您想要的任何内容,例如8000.例如:

"scripts": {
"build": "webpack --config webpack.prod.js --progress",
"watch": "npm run build -- --watch",
"server": "webpack-dev-server --inline --progress --port 8000 --content-base src",
"start": "npm run server"
}

早些时候端口号是3000的,并且在npm start不同的应用程序使用在端口3000上渲染,因此对于我的新应用程序,我给出了端口号8000。现在我可以在不同的端口上有两个不同的应用程序(本地主机:3000 和本地主机:8000(,而不会出错。