Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/36.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/powerbi/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 如何使用nodemon运行ECMAScript(mjs文件)?_Node.js_Nodemon_Mjs - Fatal编程技术网

Node.js 如何使用nodemon运行ECMAScript(mjs文件)?

Node.js 如何使用nodemon运行ECMAScript(mjs文件)?,node.js,nodemon,mjs,Node.js,Nodemon,Mjs,我能够使用--实验模块标志使用nodejs运行mjs文件 节点——实验模块索引.mjs package.json: { "name": "mjs-tests", "version": "1.0.0", "description": "", "main": "index.js", "scripts": { "dev": "nodemon index.mjs" }, "keywords": [], "author":

我能够使用
--实验模块
标志使用nodejs运行mjs文件

节点——实验模块索引.mjs
package.json:

{
    "name": "mjs-tests",
    "version": "1.0.0",
    "description": "",
    "main": "index.js",
    "scripts": {
        "dev": "nodemon index.mjs"
    },
    "keywords": [],
    "author": "",
    "license": "ISC",
    "dependencies": {
        "chalk": "^2.4.2",
        "uuid": "^3.3.2"
    },
    "devDependencies": {
        "nodemon": "^1.19.1"
    }
}
和index.mjs


从“http”导入http
const server=http.createServer((req,res)=>{
res.end('你好')
})
常数端口=5000
服务器。侦听(端口,()=>{
log(`当然,您只需要稍微修改一下package.json

  "scripts": {
        "dev": "nodemon --experimental-modules index.mjs"
    },

我想我也试过这个。谢谢,@adii,它很管用。