首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在构建时面对‘找不到模块'@babel/plugin-transform-react-jsx'`

在构建时面对‘找不到模块'@babel/plugin-transform-react-jsx'`
EN

Stack Overflow用户
提问于 2018-11-04 20:41:17
回答 2查看 2K关注 0票数 0

在使用bitbucket pipeline构建我的(以前工作的)应用程序时,我遇到了以下错误:

代码语言:javascript
复制
...

[4/4] Building fresh packages...
success Saved lockfile.
success Saved 1 new dependency.
└─ babel-core@6.26.3
Done in 22.08s.
  /opt/atlassian/pipelines/agent/build/src/index.js: Cannot find module '@babel/plugin-transform-react-jsx'
    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 (/opt/atlassian/pipelines/agent/build/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
    at /opt/atlassian/pipelines/agent/build/node_modules/parcel-bundler/lib/transforms/babel/jsx.js:51:22
    at Generator.next (<anonymous>)
    at asyncGeneratorStep (/opt/atlassian/pipelines/agent/build/node_modules/@babel/runtime/helpers/asyncToGenerator.js:3:24)
    at _next (/opt/atlassian/pipelines/agent/build/node_modules/@babel/runtime/helpers/asyncToGenerator.js:25:9)
npm info lifecycle parcel-react@1.0.0~build: Failed to exec build script
npm ERR! Linux 4.14.63-coreos
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "build"
npm ERR! node v7.10.1
npm ERR! npm  v4.2.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! parcel-react@1.0.0 build: `parcel build index.html --public-url ./`
npm ERR! Exit status 1
...

我的package.json的脚本和与依赖项相关的行如下所示:

代码语言:javascript
复制
  "scripts": {
    "start": "parcel index.html",
    "build": "parcel build index.html --public-url ./",
    "deploy": "firebase deploy --token $FIREBASE_TOKEN"
  },
  ...
  "dependencies": {
    "axios": "^0.18.0",
    "babel-plugin-transform-class-properties": "^6.24.1",
    "babel-plugin-transform-object-rest-spread": "^6.26.0",
    "classnames": "^2.2.6",
    "firebase": "^5.5.7",
    "immutable": "^3.8.2",
    "lodash": "^4.17.10",
    "mark-twain": "^2.0.3",
    "node-sass": "^4.7.2",
    "parcel-plugin-markdown": "^0.3.1",
    "react": "^0.14.0 || ^15.0.0-0 || ^16.0.0-0",
    "react-dom": "^16.2.0",
    "react-iframe": "^1.3.3",
    "react-redux": "^5.0.7",
    "react-router-dom": "^4.3.1",
    "redux": "^2.0.0 || ^3.0.0 || ^4.0.0-0",
    "redux-actions": "^2.6.1",
    "redux-axios-middleware": "^4.0.0",
    "simple-markdown": "^0.4.2",
    "slate": "^0.38.1",
    "slate-plain-serializer": "^0.6.0",
    "slate-react": "^0.16.1"
  },
  "devDependencies": {
    "babel-preset-env": "^1.7.0",
    "babel-preset-react": "^6.24.1",
    "firebase-tools": "^3.19.3",
    "parcel-bundler": "^1.5.1"
  }

有没有人知道是什么导致了这个错误,又是从哪种依赖中产生的?我试图删除所有的babel依赖,只是为了测试它,但仍然得到错误。

EN

回答 2

Stack Overflow用户

发布于 2021-01-11 20:26:49

在bitbucket中,单击进入管道,在右上角您可以访问缓存,在那里您可以清除node_modules缓存并重新运行,它应该构建

票数 0
EN

Stack Overflow用户

发布于 2018-11-12 20:40:12

在管道中使用纱线代替npm解决了这个问题。无论如何,我在开发过程中使用了纱线。

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

https://stackoverflow.com/questions/53140918

复制
相关文章

相似问题

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