最新消息: USBMI致力于为网友们分享Windows、安卓、IOS等主流手机系统相关的资讯以及评测、同时提供相关教程、应用、软件下载等服务。

uniapp cli化一键游项目启动报错总结

维修 admin 37浏览 0评论

uniapp cli化一键游项目启动报错总结

问题1、使用hbuilder运行指令,开始编译后没有反应,使用命令构建自行结束进程

解决:因为使用了node16.24,卸载重新安装14.17后解决

问题2、


21:31:11.483 Module build failed (from ./node_modules/@vue/cli-service/node_modules/mini-css-extract-plugin/dist/loader.js):
21:31:11.483 ModuleBuildError: Module build failed (from ./node_modules/@dcloudio/vue-cli-plugin-uni/packages/sass-loader/dist/cjs.js):
21:31:11.496 ValidationError: Invalid options object. Sass Loader has been initialized using an options object that does not match the API schema.
21:31:11.502  - options has an unknown property 'data'. These properties are valid:
21:31:11.502    object { implementation?, sassOptions?, prependData?, sourceMap?, webpackImporter? }
21:31:11.505     at validate (D:\lfkj\code\uniapp\yjygx-mini-app\node_modules\@dcloudio\vue-cli-plugin-uni\packages\sass-loader\node_modules\schema-utils\dist\validate.js:96:11)
21:31:11.505     at Object.loader (D:\lfkj\code\uniapp\yjygx-mini-app\node_modules\@dcloudio\vue-cli-plugin-uni\packages\sass-loader\dist\index.js:36:28)
21:31:11.515     at D:\lfkj\code\uniapp\yjygx-mini-app\node_modules\webpack\lib\NormalModule.js:316:20
21:31:11.515     at D:\lfkj\code\uniapp\yjygx-mini-app\node_modules\loader-runner\lib\LoaderRunner.js:367:11
21:31:11.515     at D:\lfkj\code\uniapp\yjygx-mini-app\node_modules\loader-runner\lib\LoaderRunner.js:233:18
21:31:11.530     at runSyncOrAsync (D:\lfkj\code\uniapp\yjygx-mini-app\node_modules\loader-runner\lib\LoaderRunner.js:143:3)
21:31:11.530     at iterateNormalLoaders (D:\lfkj\code\uniapp\yjygx-mini-app\node_modules\loader-runner\lib\LoaderRunner.js:232:2)
21:31:11.539     at iterateNormalLoaders (D:\lfkj\code\uniapp\yjygx-mini-app\node_modules\loader-runner\lib\LoaderRunner.js:221:10)
21:31:11.540     at D:\lfkj\code\uniapp\yjygx-mini-app\node_modules\loader-runner\lib\LoaderRunner.js:236:3
21:31:11.546     at Object.<anonymous> (D:\lfkj\code\uniapp\yjygx-mini-app\node_modules\loader-runner\lib\LoaderRunner.js:111:13)
21:31:11.546     at Object.<anonymous> (D:\lfkj\code\uniapp\yjygx-mini-app\node_modules\@dcloudio\vue-cli-plugin-uni\packages\webpack-preprocess-loader\index.js:60:8)
21:31:11.724  ERROR  Build failed with errors.

更改vue.config.js的配置如下

module.exports = {/* css配置 */css: {loaderOptions: {/* 全局引用 scss 文件 */sass: {additionalData: `@import "@/assets/css/mixin.scss";`},},},
}

更改为additionalData ==》 prependData

module.exports = {/* css配置 */css: {loaderOptions: {/* 全局引用 scss 文件 */sass: {prependData: `@import "@/assets/css/mixin.scss";`},},},
}

解决方案,node版本过高

"node-sass": "^4.14.1",
"sass-loader": "^8.0.2",

问题3、

gyp find PythonERR! find Python Python is not set from command line or npm 

解决方案

npm install --global --production windows-build-tools

问题4、

Syntax Error: Error: Node Sass version 6.0.1 is incompatible with ^4.0.0.

 解决方案,node版本过高

"node-sass": "^4.14.1",
"sass-loader": "^8.0.2",

uniapp cli化一键游项目启动报错总结

问题1、使用hbuilder运行指令,开始编译后没有反应,使用命令构建自行结束进程

解决:因为使用了node16.24,卸载重新安装14.17后解决

问题2、


21:31:11.483 Module build failed (from ./node_modules/@vue/cli-service/node_modules/mini-css-extract-plugin/dist/loader.js):
21:31:11.483 ModuleBuildError: Module build failed (from ./node_modules/@dcloudio/vue-cli-plugin-uni/packages/sass-loader/dist/cjs.js):
21:31:11.496 ValidationError: Invalid options object. Sass Loader has been initialized using an options object that does not match the API schema.
21:31:11.502  - options has an unknown property 'data'. These properties are valid:
21:31:11.502    object { implementation?, sassOptions?, prependData?, sourceMap?, webpackImporter? }
21:31:11.505     at validate (D:\lfkj\code\uniapp\yjygx-mini-app\node_modules\@dcloudio\vue-cli-plugin-uni\packages\sass-loader\node_modules\schema-utils\dist\validate.js:96:11)
21:31:11.505     at Object.loader (D:\lfkj\code\uniapp\yjygx-mini-app\node_modules\@dcloudio\vue-cli-plugin-uni\packages\sass-loader\dist\index.js:36:28)
21:31:11.515     at D:\lfkj\code\uniapp\yjygx-mini-app\node_modules\webpack\lib\NormalModule.js:316:20
21:31:11.515     at D:\lfkj\code\uniapp\yjygx-mini-app\node_modules\loader-runner\lib\LoaderRunner.js:367:11
21:31:11.515     at D:\lfkj\code\uniapp\yjygx-mini-app\node_modules\loader-runner\lib\LoaderRunner.js:233:18
21:31:11.530     at runSyncOrAsync (D:\lfkj\code\uniapp\yjygx-mini-app\node_modules\loader-runner\lib\LoaderRunner.js:143:3)
21:31:11.530     at iterateNormalLoaders (D:\lfkj\code\uniapp\yjygx-mini-app\node_modules\loader-runner\lib\LoaderRunner.js:232:2)
21:31:11.539     at iterateNormalLoaders (D:\lfkj\code\uniapp\yjygx-mini-app\node_modules\loader-runner\lib\LoaderRunner.js:221:10)
21:31:11.540     at D:\lfkj\code\uniapp\yjygx-mini-app\node_modules\loader-runner\lib\LoaderRunner.js:236:3
21:31:11.546     at Object.<anonymous> (D:\lfkj\code\uniapp\yjygx-mini-app\node_modules\loader-runner\lib\LoaderRunner.js:111:13)
21:31:11.546     at Object.<anonymous> (D:\lfkj\code\uniapp\yjygx-mini-app\node_modules\@dcloudio\vue-cli-plugin-uni\packages\webpack-preprocess-loader\index.js:60:8)
21:31:11.724  ERROR  Build failed with errors.

更改vue.config.js的配置如下

module.exports = {/* css配置 */css: {loaderOptions: {/* 全局引用 scss 文件 */sass: {additionalData: `@import "@/assets/css/mixin.scss";`},},},
}

更改为additionalData ==》 prependData

module.exports = {/* css配置 */css: {loaderOptions: {/* 全局引用 scss 文件 */sass: {prependData: `@import "@/assets/css/mixin.scss";`},},},
}

解决方案,node版本过高

"node-sass": "^4.14.1",
"sass-loader": "^8.0.2",

问题3、

gyp find PythonERR! find Python Python is not set from command line or npm 

解决方案

npm install --global --production windows-build-tools

问题4、

Syntax Error: Error: Node Sass version 6.0.1 is incompatible with ^4.0.0.

 解决方案,node版本过高

"node-sass": "^4.14.1",
"sass-loader": "^8.0.2",

发布评论

评论列表 (0)

  1. 暂无评论