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

2fjabf4q  于 2022-11-14  发布在  Node.js
关注(0)|答案(1)|浏览(114)

I am trying to install babel watch after I have installed babel my json file is as follows

{
  "name": "t3",
  "version": "1.0.0",
  "description": "",
  "main": "app.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "build": "babel server.js --out-dir build",
    "dev-start": "babel-watch server.js"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "express": "^4.17.1"
  },
  "devDependencies": {
    "babel-cli": "^6.26.0",
    "babel-preset-env": "^1.7.0",
    "babel-watch": "^7.0.0"
  }
}

but i am getting this error while running npm run dev-start
t3@1.0.0 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. (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! t3@1.0.0 dev-start: babel-watch server.js npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the t3@1.0.0 dev-start script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

7y4bm7vi

7y4bm7vi1#

[更新]你可能已经更新了巴别塔。查看https://github.com/babel/babel/issues/8908 & How to upgrade to babel 7
尝试

npm install @babel/core --save

相关问题