在node.js中设置babel-watch时遇到问题

问题描述 投票:0回答:1

我在安装babel后尝试安装babel手表我的json文件如下[]

{

“名称”:“ t3”,

“版本”:“ 1.0.0”,

“描述”:“”,

“ main”:“ app.js”,

“脚本”:{

"test": "echo \"Error: no test specified\" && exit 1",

"build": "babel server.js --out-dir build",

"dev-start": "babel-watch server.js"

},

“作者”:“”,

“许可证”:“ ISC”,

“依赖项:{

"express": "^4.17.1"

},

“ devDependencies”:{

"babel-cli": "^6.26.0",

"babel-preset-env": "^1.7.0",

"babel-watch": "^7.0.0"

}

}

但是我在运行时遇到此错误npm run dev-start

npm run dev-start

> [email protected] dev-start C:\Users\PRO\Desktop\t3
> babel-watch server.js

internal/modules/cjs/loader.js:583
    throw err;
    ^

Error: Cannot find module '@babel/core'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
    at Function.Module._load (internal/modules/cjs/loader.js:507:25)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at Object.<anonymous> (C:\Users\PRO\Desktop\t3\node_modules\babel-watch\babel-watch.js:7:15)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] dev-start: `babel-watch server.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] dev-start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

我在安装babel之后尝试安装babel手表,我的json文件如下{“ name”:“ t3”,“ version”:“ 1.0.0”,“ description”:“”,“ main”: “ app.js”,“ scripts”:{“ test”:“ echo \” ...

npm
1个回答
0
投票

尝试

© www.soinside.com 2019 - 2024. All rights reserved.