taro1.3.2使用云开发模板后,无法成功编译项目



  • taro1.3.2使用云开发模板后,无法成功编译项目,报错如下:
    ReferenceError: Unknown plugin "transform-decorators-legacy" specified in "base"
    at 0, attempted to resolve relative to "D:\app\client\src"
    at D:\app\client\node_modules_babel-core@6.26.3@babel-core\lib\transformati
    on\file\options\option-manager.js:180:17
    at Array.map (<anonymous>)
    at Function.normalisePlugins (D:\app\client\node_modules_babel-core@6.26.3@
    babel-core\lib\transformation\file\options\option-manager.js:158:20)
    at OptionManager.mergeOptions (D:\app\client\node_modules_babel-core@6.26.3
    @babel-core\lib\transformation\file\options\option-manager.js:234:36)
    at OptionManager.init (D:\app\client\node_modules_babel-core@6.26.3@babel-c
    ore\lib\transformation\file\options\option-manager.js:368:12)
    at File.initOptions (D:\app\client\node_modules_babel-core@6.26.3@babel-cor
    e\lib\transformation\file\index.js:212:65)
    at new File (D:\app\client\node_modules_babel-core@6.26.3@babel-core\lib\tr
    ansformation\file\index.js:135:24)
    at Pipeline.transform (D:\app\client\node_modules_babel-core@6.26.3@babel-c
    ore\lib\transformation\pipeline.js:46:16)
    at babel (D:\app\client\node_modules_@tarojs_plugin-babel@1.3.2@@tarojs\plu
    gin-babel\index.js:8:17)
    at Object.<anonymous> (C:\Users\Administrator\AppData\Roaming\npm\node_modul
    es@tarojs\cli\dist\util\npm.js:133:12)



  • taro info 一下。 然后附上 package.json 的信息



  • @三金
    D:\app\client>taro info
    � Taro v1.3.2

    Taro CLI 1.3.2 environment info:
    System:
    OS: Windows 7
    Binaries:
    Node: 8.10.0 - C:\Program Files\nodejs\node.EXE
    npm: 5.6.0 - C:\Program Files\nodejs\npm.CMD

    package.json信息如下:
    {
    "name": "app",
    "version": "1.0.0",
    "private": true,
    "description": "this is a business project.",
    "templateInfo": {
    "name": "wxcloud",
    "typescript": true,
    "css": "less"
    },
    "scripts": {
    "build:weapp": "taro build --type weapp",
    "build:swan": "taro build --type swan",
    "build:alipay": "taro build --type alipay",
    "build:tt": "taro build --type tt",
    "build:h5": "taro build --type h5",
    "build:rn": "taro build --type rn",
    "dev:weapp": "npm run build:weapp -- --watch",
    "dev:swan": "npm run build:swan -- --watch",
    "dev:alipay": "npm run build:alipay -- --watch",
    "dev:tt": "npm run build:tt -- --watch",
    "dev:h5": "npm run build:h5 -- --watch",
    "dev:rn": "npm run build:rn -- --watch"
    },
    "author": "",
    "license": "MIT",
    "dependencies": {
    "@tarojs/components": "1.3.2",
    "@tarojs/router": "1.3.2",
    "@tarojs/taro": "1.3.2",
    "@tarojs/taro-alipay": "1.3.2",
    "@tarojs/taro-h5": "1.3.2",
    "@tarojs/taro-swan": "1.3.2",
    "@tarojs/taro-tt": "1.3.2",
    "@tarojs/taro-weapp": "^1.3.2",
    "@tarojs/webpack-runner": "^1.3.2",
    "nerv-devtools": "^1.4.0",
    "nervjs": "^1.4.0"
    },
    "devDependencies": {
    "@tarojs/plugin-babel": "^1.3.2",
    "@tarojs/plugin-csso": "1.3.2",
    "@tarojs/plugin-less": "1.3.2",
    "@tarojs/plugin-uglifyjs": "1.3.2",
    "@tarojs/webpack-runner": "1.3.2",
    "@types/react": "^16.4.6",
    "@types/webpack-env": "^1.13.6",
    "@typescript-eslint/parser": "^1.6.0",
    "babel-eslint": "^8.2.3",
    "babel-plugin-transform-class-properties": "^6.24.1",
    "babel-plugin-transform-decorators-legacy": "^1.3.4",
    "babel-plugin-transform-jsx-stylesheet": "^0.6.5",
    "babel-plugin-transform-object-rest-spread": "^6.26.0",
    "babel-preset-env": "^1.6.1",
    "eslint": "^4.19.1",
    "eslint-config-taro": "1.3.2",
    "eslint-plugin-import": "^2.12.0",
    "eslint-plugin-react": "^7.8.2",
    "eslint-plugin-taro": "1.3.2",
    "typescript": "^3.0.1"
    }
    }



  • 你删掉 node_modules 重装一下?



  • 已经解决了。我用yarn重新安装了taro,之前都是用npm和cnpm安装的taro,发现使用云开发模板有问题。
    新建项目后用yarn dev:weapp执行编译。



  • @三金 { Error: Cannot find module 'babel-core'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
    at Function.Module._load (internal/modules/cjs/loader.js:508:25)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at Object.<anonymous> (D:\project\mini-program\waste-sort\node_modules_@tarojs_plugin-babel@1.3.9@@tarojs\plugin-babel\index.js:1:85)
    at Module._compile (internal/modules/cjs/loader.js:701:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
    at Module.load (internal/modules/cjs/loader.js:600:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
    at Function.Module._load (internal/modules/cjs/loader.js:531:3) code: 'MODULE_NOT_FOUND' }
    执行npm run dev:weapp的时候报错


登录后回复