常见报错整理

版权声明:未经同意,不得随意转载转载 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 中,默认是启用严格模式的,所以,这两者冲突了;
  • 解决方案:
  1. 把 mui.js 中的 非严格 模式的代码改掉;但是不现实;
  2. 把 webpack 打包时候的严格模式禁用掉;
  1. 安装:npm install babel-plugin-transform-remove-strict-mode
  2. 根据使用方法配置文件

.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"]
});

例如:
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/lucky541788/article/details/83509069
今日推荐