UnhandledPromiseRejectionWarning: TypeError: path.charAt is not a function 这个错误,我看了一下,依赖包的版本也是正常的,求解决方案
-
Taro v2.2.9
生成 工具配置 /mnt/e/mydemo/zkh-gbb-shop-weapp/build/project.config.json
(node:29998) UnhandledPromiseRejectionWarning: TypeError: path.charAt is not a function
at posix (/mnt/e/mydemo/zkh-gbb-shop-weapp/node_modules/path-is-absolute/index.js:4:14)
at ConfigChainBuilder.findConfigs (/mnt/e/mydemo/zkh-gbb-shop-weapp/node_modules/babel-core/lib/transformation/file/options/build-config-chain.js:85:39)
at buildConfigChain (/mnt/e/mydemo/zkh-gbb-shop-weapp/node_modules/babel-core/lib/transformation/file/options/build-config-chain.js:61:13)
at OptionManager.init (/mnt/e/mydemo/zkh-gbb-shop-weapp/node_modules/babel-core/lib/transformation/file/options/option-manager.js:354:58)
at File.initOptions (/mnt/e/mydemo/zkh-gbb-shop-weapp/node_modules/babel-core/lib/transformation/file/index.js:212:65)
at new File (/mnt/e/mydemo/zkh-gbb-shop-weapp/node_modules/babel-core/lib/transformation/file/index.js:135:24)
at Pipeline.transform (/mnt/e/mydemo/zkh-gbb-shop-weapp/node_modules/babel-core/lib/transformation/pipeline.js:46:16)
at babel (/mnt/e/mydemo/zkh-gbb-shop-weapp/node_modules/@tarojs/plugin-babel/index.js:8:17)
at Kernel.initPlugin (/root/.nvm/versions/node/v12.16.2/lib/node_modules/@tarojs/cli/node_modules/@tarojs/service/dist/Kernel.js:117:16)
at Kernel.resolvePlugins (/root/.nvm/versions/node/v12.16.2/lib/node_modules/@tarojs/cli/node_modules/@tarojs/service/dist/Kernel.js:92:18)
(node:29998) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag--unhandled-rejections=strict
(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:29998) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:29998) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'sassLoaderOption' of undefined
at /mnt/e/mydemo/zkh-gbb-shop-weapp/node_modules/@tarojs/plugin-sass/dist/index.js:33:50
at Generator.next (<anonymous>)
at /mnt/e/mydemo/zkh-gbb-shop-weapp/node_modules/@tarojs/plugin-sass/dist/index.js:8:71
at new Promise (<anonymous>)
at __awaiter (/mnt/e/mydemo/zkh-gbb-shop-weapp/node_modules/@tarojs/plugin-sass/dist/index.js:4:12)
at Object.fn (/mnt/e/mydemo/zkh-gbb-shop-weapp/node_modules/@tarojs/plugin-sass/dist/index.js:14:43)
at Kernel.<anonymous> (/root/.nvm/versions/node/v12.16.2/lib/node_modules/@tarojs/cli/node_modules/@tarojs/service/dist/Kernel.js:199:48)
at Generator.next (<anonymous>)
at /root/.nvm/versions/node/v12.16.2/lib/node_modules/@tarojs/cli/node_modules/@tarojs/service/dist/Kernel.js:8:71
at new Promise (<anonymous>)
at __awaiter (/root/.nvm/versions/node/v12.16.2/lib/node_modules/@tarojs/cli/node_modules/@tarojs/service/dist/Kernel.js:4:12)
at /root/.nvm/versions/node/v12.16.2/lib/node_modules/@tarojs/cli/node_modules/@tarojs/service/dist/Kernel.js:198:33
at eval (eval at create (/root/.nvm/versions/node/v12.16.2/lib/node_modules/@tarojs/cli/node_modules/tapable/lib/HookCodeFactory.js:74:10), <anonymous>:14:17)
at new Promise (<anonymous>)
at AsyncSeriesWaterfallHook.eval [as promise] (eval at create (/root/.nvm/versions/node/v12.16.2/lib/node_modules/@tarojs/cli/node_modules/tapable/lib/HookCodeFactory.js:74:10), <anonymous>:2:8)
at AsyncSeriesWaterfallHook.lazyCompileHook (/root/.nvm/versions/node/v12.16.2/lib/node_modules/@tarojs/cli/node_modules/tapable/lib/Hook.js:154:20)
(node:29998) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag--unhandled-rejections=strict
(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 3)package.json的文件如下
{
"name": "zkh-gbb-shop-weapp",
"version": "1.0.0",
"private": true,
"description": "a program for wechat xiaochengxu",
"templateInfo": {
"name": "mobx",
"typescript": true,
"css": "sass"
},
"main": "index.js",
"scripts": {
"build": "taro build --type h5",
"start": "taro build --type h5",
"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/async-await": "2.2.9",
"@tarojs/components": "2.2.9",
"@tarojs/mini-runner": "^2.2.9",
"@tarojs/mobx": "2.2.9",
"@tarojs/mobx-h5": "2.2.9",
"@tarojs/mobx-rn": "2.2.9",
"@tarojs/rn-runner": "2.2.9",
"@tarojs/router": "2.2.9",
"@tarojs/taro": "2.2.9",
"@tarojs/taro-alipay": "2.2.9",
"@tarojs/taro-h5": "2.2.9",
"@tarojs/taro-swan": "2.2.9",
"@tarojs/taro-tt": "2.2.9",
"@tarojs/taro-weapp": "2.2.9",
"mobx": "4.8.0",
"nerv-devtools": "^1.5.7",
"nervjs": "^1.5.7",
"query-string": "^6.8.3",
"taro-ui": "^2.2.4"
},
"devDependencies": {
"@tarojs/plugin-babel": "^2.2.9",
"@tarojs/plugin-csso": "2.2.9",
"@tarojs/plugin-sass": "^2.2.9",
"@tarojs/plugin-uglifyjs": "2.2.9",
"@tarojs/webpack-runner": "2.2.9",
"@types/react": "16.3.14",
"@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": "^5.16.0",
"eslint-config-taro": "2.2.9",
"eslint-plugin-import": "^2.12.0",
"eslint-plugin-react": "^7.8.2",
"eslint-plugin-react-hooks": "^1.6.1",
"eslint-plugin-taro": "2.2.9",
"stylelint": "9.3.0",
"stylelint-config-taro-rn": "^1.3.9",
"stylelint-taro-rn": "^1.3.9",
"typescript": "^3.0.1"
}
}
-
楼主解决了么,我也遇到相同问题