[英]npm start run error “var before = prev.prev || {}; TypeError: Cannot read property 'prev' of undefined”
Currently I am trying to run a very basic to do list using node. 目前,我正在尝试使用节点运行一个非常基本的待办事项列表。 After setting up package.json and server.js, I ran npm start run, but I am getting a weird error.
设置package.json和server.js之后,我运行了npm start run,但是出现一个奇怪的错误。
UPDATE: Here is the basic code and .json file: enter image description here 更新:这是基本代码和.json文件: 在此处输入图像描述
var express = require('express'),
var express = require('express'),
app = express(),app = express(),
port =process.env.PORT ||3000;端口= process.env.PORT || 3000;
app.listen(port);
app.listen(端口);
console.log('todo list RESTful API server started on: ' + port);
console.log('待办事项列表RESTful API服务器启动于:'+端口);
I ran into the same problem with nodemon when running my test scripts in a node.js api. 在node.js api中运行测试脚本时,我遇到了与nodemon相同的问题。
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 . 看来该错误与nanomatch这个问题相关,nodemon使用了一个软件包,该链接指向该问题: https : //github.com/micromatch/nanomatch/issues/15 。
I solved it with the following steps: 我通过以下步骤解决了它:
After these steps nodemon worked for me. 经过这些步骤,nodemon为我工作。 Hope that helps.
希望能有所帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.