执行npm run dev报错。具体描述如下:
npm script定义是:
“scripts”: {
“dev:build”: “tsc -w”,
“dev:start”: “nodemon node ./dist/crowler.js”,
“dev”: “concurrently npm:dev:"
},
“nodemonConfig”: {
“ignore”: [
"data/”
]
},
我和视频中不一样的是:删掉了dist目录和data目录下的course.json,执行npm run dev后报错:
[dev:start] [nodemon] starting node node ./dist/crowler.js index.js
[dev:start] internal/modules/cjs/loader.js:797
[dev:start] throw err;
[dev:start] ^
[dev:start]
[dev:start] Error: Cannot find module ‘E:\imooc\web-crowler\index.js’
[dev:start] at Function.Module._resolveFilename (internal/modules/cjs/loader.js:794:15)
[dev:start] at Function.Module._load (internal/modules/cjs/loader.js:687:27)
[dev:start] at Function.Module.runMain (internal/modules/cjs/loader.js:1025:10)
[dev:start] at internal/main/run_main_module.js:17:11 {
[dev:start] code: ‘MODULE_NOT_FOUND’,
[dev:start] requireStack: []
[dev:start] }
看来后面一个命令,没有等到前一个命令执行结束后就执行了。请问老师这种情况下该如何解决比较好?