javascript - npm start 运行错误“var before = prev.prev || {}; TypeError:无法读取未定义的属性'prev'”
问题描述
目前我正在尝试使用节点运行一个非常基本的待办事项列表。设置好 package.json 和 server.js 后,我运行了 npm start run,但出现了一个奇怪的错误。
更新:这是基本代码和 .json 文件: 在此处输入图像描述
var express = require('express'),
app = express(),
port =process.env.PORT ||3000;app.listen(端口);
console.log('todo list RESTful API server started on: ' + port);
解决方案
I ran into the same problem with nodemon when running my test scripts in a node.js api.
It seems the error is related to this issue with nanomatch, a package nodemon uses, a link to the issue: https://github.com/micromatch/nanomatch/issues/15.
I solved it with the following steps:
- Verify the version of nanomatch in node_modules/nanomatch/package.json if the version is 1.2.11 (I also had a similar issue with 1.2.9) you need to change its version.
- Run npm i nanomatch@1.2.13 (--save or --save-dev according to your situation)
After these steps nodemon worked for me. Hope that helps.
推荐阅读
- python - 如何使用 Selenium 和 Python 点击启用 ember.js 的按钮
- javascript - 如何在令牌过期和/或刷新页面后使用 Firebase 在 Next.js 中保持身份验证
- python - 通过联系电话或电子邮件地址识别重复的客户元组
- java - Scala 将 Map[String, Any] 中的 ArrayList 转换为 Seq
- r - 当行可以由多个分类变量定义时,如何根据分类变量对数据框进行子集化
- google-chrome-extension - 如何使用 tabId 和 chrome 扩展 API 获取用户当前所在网站的 HTML 源代码?
- java - 尝试使用 JavaFX 和 FXML,但由于 InvocationTargetExceptions 和 NullExceptions 导致程序无法运行
- java - 如何在Android中用一条线连接两个按钮?
- java - Java不将0xFC视为有符号整数?
- r - 包“ade4”的问题