首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >gulp找不到模块@babel/core

gulp找不到模块@babel/core
EN

Stack Overflow用户
提问于 2018-09-13 08:25:33
回答 1查看 2K关注 0票数 1

我试图使用引发此错误的sudo gulp构建环境:

代码语言:javascript
复制
[14:22:36] 'scripts' errored after 12 ms
[14:22:36] Error: Cannot find module '@babel/core'
    at Function.Module._resolveFilename (module.js:470:15)
    at Function.Module._load (module.js:418:25)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/home/ubuntu/armory_frontend/node_modules/gulp-babel/index.js:7:15)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)

我似乎有依赖关系问题,所以我要添加我的package.json文件:

代码语言:javascript
复制
{
      "private": true,
      "engines": {
        "node": ">=4"
      },
      "devDependencies": {
        "amd-optimize": "^0.6.1",
        "babel-cli": ">=6.24.1",
        "babel-core": ">=6.4.0",
        "babel-preset-env": ">=1.0.0",
        "babel-preset-stage-2": ">=0.0.1",
        "babel-preset-react": "^6.24.1",
        "babel-register": ">=6.5.2",
        "browser-sync": ">=2.2.1",
        "chai": ">=3.5.0",
        "del": ">=1.1.1",
        "gulp": ">=3.9.0",
        "gulp-autoprefixer": ">=3.1.0",
        "gulp-babel": ">=6.1.1",
        "gulp-cache": ">=0.4.2",
        "gulp-concat": ">=2.6.0",
        "gulp-cssnano": ">=2.0.0",
        "gulp-eslint": ">=2.0.0",
        "gulp-filter": ">=4.0.0",
        "gulp-flatten": ">=0.3.0",
        "gulp-htmlmin": ">=1.3.0",
        "gulp-if": ">=2.0.0",
        "gulp-imagemin": ">=2.2.1",
        "gulp-load-plugins": ">=0.10.0",
        "gulp-path": ">=3.0.3",
        "gulp-plumber": ">=1.0.1",
        "gulp-react": "^3.1.0",
        "gulp-sass": ">=2.0.0",
        "gulp-size": ">=1.2.1",
        "gulp-sourcemaps": ">=1.5.0",
        "gulp-uglify": ">=1.1.0",
        "gulp-uglify-es": ">=1.0.0",
        "gulp-useref": ">=3.0.0",
        "gulp-util": ">=3.0.7",
        "pump": ">=1.0.0",
        "main-bower-files": ">=2.5.0",
        "mocha": ">=2.5.3",
        "uglify-es": ">=1.0.0",
        "wiredep": ">=2.2.2"
      },
      "eslintConfig": {
        "env": {
          "es6": true,
          "node": true,
          "browser": true
        },
        "rules": {
          "quotes": [
            2,
            "single"
          ]
        }
      },
      "dependencies": {
        "babel-eslint": "^7.2.3",
        "babelify": "^7.3.0",
        "bootstrap": "=4.0.0-alpha.6",
        "browserify": "^14.4.0",
        "eslint-plugin-react": "^7.1.0",
        "fancybox-plus": "^1.3.8",
        "flag-icon-css": ">=2.7.0",
        "font-awesome": ">=4.6.3",
        "gulp-notify": "^3.0.0",
        "jquery.easing": "^1.4.1",
        "json2csv": ">=3.7.3",
        "jsx": "^0.9.89",
        "modernizr": ">=3.0.0",
        "nprogress": ">=0.2.0",
        "open-sans-fontface": ">=1.4.0",
        "prop-types": "^15.5.10",
        "react": "^15.6.1",
        "react-circular-progressbar": "^0.5.0",
        "react-dom": "^15.6.1",
        "react-edit-inline": "^1.0.8",
        "resemblejs": ">=2.2.3",
        "tether": ">=1.3.2",
        "vinyl-buffer": "^1.0.0",
        "vinyl-source-stream": "^1.1.0",
        "ws": "^3.2.0"
      }
    }

我已经读到,babel有一个问题,就是将模块名从@babel/core更改为babel-core,这与我当前的配置有什么不同吗?

我的哪个包试图使用新的@babel/core

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-09-13 13:16:40

只需将@babel/core添加到"devDependencies"

就像这样:

"@babel/core": "^7.0.0",

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/52309558

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档