版权声明:未经同意,不得随意转载转载 https://blog.csdn.net/lucky541788/article/details/83509069
1.端口被占用:Error:listen EADDRINUSE 127.0.0.1:3000
原因:后台可能有node占用3000端口;
解决一:启动任务管理器,关闭其他node程序;
解决二:下图
2.初始化 滑动条 的时候,导入的 mui.js 报错
Uncaught TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode
- 是因为 mui.js 中用到了 ‘caller’, ‘callee’, and ‘arguments’ 东西,但是, webpack 打包好的 bundle.js 中,默认是启用严格模式的,所以,这两者冲突了;
- 解决方案:
- 把 mui.js 中的 非严格 模式的代码改掉;但是不现实;
- 把 webpack 打包时候的严格模式禁用掉;
- 最终,我选择了 2 移除严格模式: 使用这个插件 babel-plugin-transform-remove-strict-mode
- 安装:
npm install babel-plugin-transform-remove-strict-mode
- 根据使用方法配置文件
.babelrc
{
"plugins": ["transform-remove-strict-mode"]
}
Via cli
babel --plugins transform-remove-strict-mode script.js
Via Node API
require("babel-core").transform("code", {
plugins: ["transform-remove-strict-mode"]
});
例如: