Vue CLI v4.1.2
✨ Creating project in /Users/zongyunlong/Documents/study/uni-app-test.
🗃 Initializing git repository...
⚙ Installing CLI plugins. This might take a while...
yarn install v1.22.4
info No lockfile found.
[1/4] 🔍 Resolving packages...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
[2/4] 🚚 Fetching packages...
[3/4] 🔗 Linking dependencies...
[4/4] 🔨 Building fresh packages...
success Saved lockfile.
✨ Done in 244.55s.
🚀 Invoking generators...
yarn install v1.22.4
[1/4] 🔍 Resolving packages...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
[2/4] 🚚 Fetching packages...
info There appears to be trouble with your network connection. Retrying...
[3/4] 🔗 Linking dependencies...
[4/4] 🔨 Building fresh packages...
success Saved lockfile.
✨ Done in 242.45s.
⚓ Running completion hooks...
📄 Generating README.md...
🎉 Successfully created project uni-app-test.
👉 Get started with the following commands:
$ cd uni-app-test
$ yarn serve
~/Documents/study cd uni-app-test
(3------ 进入项目启动) ~/Documents/study/uni-app-test master npm run dev:mp-alipay
(4------ 报错)⠋ 开始编译当前项目至 mp-alipay 平台... ERROR Error: No matching use for foo.js
Error: No matching use for foo.js
at updateJsLoader (/Users/zongyunlong/Documents/study/uni-app-test/node_modules/@dcloudio/vue-cli-plugin-uni/lib/configure-webpack.js:58:13)
at /Users/zongyunlong/Documents/study/uni-app-test/node_modules/@dcloudio/vue-cli-plugin-uni/lib/configure-webpack.js:162:5
at /Users/zongyunlong/Documents/study/uni-app-test/node_modules/@vue/cli-service/lib/Service.js:266:21
at Array.forEach ()
at Service.resolveWebpackConfig (/Users/zongyunlong/Documents/study/uni-app-test/node_modules/@vue/cli-service/lib/Service.js:263:30)
at PluginAPI.resolveWebpackConfig (/Users/zongyunlong/Documents/study/uni-app-test/node_modules/@vue/cli-service/lib/PluginAPI.js:132:25)
at module.exports (/Users/zongyunlong/Documents/study/uni-app-test/node_modules/@vue/cli-service/lib/commands/build/resolveAppConfig.js:39:25)
at getWebpackConfig (/Users/zongyunlong/Documents/study/uni-app-test/node_modules/@dcloudio/vue-cli-plugin-uni/commands/build.js:49:88)
at getWebpackConfigs (/Users/zongyunlong/Documents/study/uni-app-test/node_modules/@dcloudio/vue-cli-plugin-uni/commands/build.js:75:13)
at build (/Users/zongyunlong/Documents/study/uni-app-test/node_modules/@dcloudio/vue-cli-plugin-uni/commands/build.js:112:26)
at /Users/zongyunlong/Documents/study/uni-app-test/node_modules/@dcloudio/vue-cli-plugin-uni/commands/build.js:40:11
at Service.run (/Users/zongyunlong/Documents/study/uni-app-test/node_modules/@vue/cli-service/lib/Service.js:245:12)
at Object. (/Users/zongyunlong/Documents/study/uni-app-test/node_modules/@vue/cli-service/bin/vue-cli-service.js:36:9)
at Module._compile (internal/modules/cjs/loader.js:936:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:947:10)
at Module.load (internal/modules/cjs/loader.js:790:32)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! uni-app-test@0.1.0 dev:mp-alipay: cross-env NODE_ENV=development UNI_PLATFORM=mp-alipay vue-cli-service uni-build --watch
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the uni-app-test@0.1.0 dev:mp-alipay script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/zongyunlong/.npm/_logs/2020-05-15T08_16_15_555Z-debug.log
问题描述 vue 初始化项目无法启动, 报错:Error: No matching use for foo.js
复现步骤 (1------vuecli 初始化项目) vue create -p dcloudio/uni-preset-vue uni-app-test ✔ Fetching remote preset dcloudio/uni-preset-vue...
Vue CLI v4.1.2 ✨ Creating project in /Users/zongyunlong/Documents/study/uni-app-test. 🗃 Initializing git repository... ⚙ Installing CLI plugins. This might take a while...
yarn install v1.22.4 info No lockfile found. [1/4] 🔍 Resolving packages... info There appears to be trouble with your network connection. Retrying... info There appears to be trouble with your network connection. Retrying... info There appears to be trouble with your network connection. Retrying... [2/4] 🚚 Fetching packages... [3/4] 🔗 Linking dependencies... [4/4] 🔨 Building fresh packages... success Saved lockfile. ✨ Done in 244.55s. 🚀 Invoking generators...
Preset options: (2-------选择ts模版) ? 请选择 uni-app 模板 默认模板(TypeScript) 📦 Installing additional dependencies...
yarn install v1.22.4 [1/4] 🔍 Resolving packages... info There appears to be trouble with your network connection. Retrying... info There appears to be trouble with your network connection. Retrying... [2/4] 🚚 Fetching packages... info There appears to be trouble with your network connection. Retrying... [3/4] 🔗 Linking dependencies... [4/4] 🔨 Building fresh packages... success Saved lockfile. ✨ Done in 242.45s. ⚓ Running completion hooks...
📄 Generating README.md...
🎉 Successfully created project uni-app-test. 👉 Get started with the following commands:
$ cd uni-app-test $ yarn serve
~/Documents/study cd uni-app-test (3------ 进入项目启动) ~/Documents/study/uni-app-test master npm run dev:mp-alipay
请注意运行模式下,因日志输出、sourcemap以及未压缩源码等原因,性能和包体积,均不及发行模式。若要正式发布,请点击发行菜单或使用cli发布命令进行发布
(4------ 报错)⠋ 开始编译当前项目至 mp-alipay 平台... ERROR Error: No matching use for foo.js Error: No matching use for foo.js at updateJsLoader (/Users/zongyunlong/Documents/study/uni-app-test/node_modules/@dcloudio/vue-cli-plugin-uni/lib/configure-webpack.js:58:13) at /Users/zongyunlong/Documents/study/uni-app-test/node_modules/@dcloudio/vue-cli-plugin-uni/lib/configure-webpack.js:162:5 at /Users/zongyunlong/Documents/study/uni-app-test/node_modules/@vue/cli-service/lib/Service.js:266:21 at Array.forEach ()
at Service.resolveWebpackConfig (/Users/zongyunlong/Documents/study/uni-app-test/node_modules/@vue/cli-service/lib/Service.js:263:30)
at PluginAPI.resolveWebpackConfig (/Users/zongyunlong/Documents/study/uni-app-test/node_modules/@vue/cli-service/lib/PluginAPI.js:132:25)
at module.exports (/Users/zongyunlong/Documents/study/uni-app-test/node_modules/@vue/cli-service/lib/commands/build/resolveAppConfig.js:39:25)
at getWebpackConfig (/Users/zongyunlong/Documents/study/uni-app-test/node_modules/@dcloudio/vue-cli-plugin-uni/commands/build.js:49:88)
at getWebpackConfigs (/Users/zongyunlong/Documents/study/uni-app-test/node_modules/@dcloudio/vue-cli-plugin-uni/commands/build.js:75:13)
at build (/Users/zongyunlong/Documents/study/uni-app-test/node_modules/@dcloudio/vue-cli-plugin-uni/commands/build.js:112:26)
at /Users/zongyunlong/Documents/study/uni-app-test/node_modules/@dcloudio/vue-cli-plugin-uni/commands/build.js:40:11
at Service.run (/Users/zongyunlong/Documents/study/uni-app-test/node_modules/@vue/cli-service/lib/Service.js:245:12)
at Object. (/Users/zongyunlong/Documents/study/uni-app-test/node_modules/@vue/cli-service/bin/vue-cli-service.js:36:9)
at Module._compile (internal/modules/cjs/loader.js:936:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:947:10)
at Module.load (internal/modules/cjs/loader.js:790:32)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! uni-app-test@0.1.0 dev:mp-alipay:
cross-env NODE_ENV=development UNI_PLATFORM=mp-alipay vue-cli-service uni-build --watch
npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the uni-app-test@0.1.0 dev:mp-alipay script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.npm ERR! A complete log of this run can be found in: npm ERR! /Users/zongyunlong/.npm/_logs/2020-05-15T08_16_15_555Z-debug.log
预期结果 [使用简洁清晰的语言描述你希望生效的预期结果] 可以启动项目
实际结果 [这里请贴上你的报错截图或文字] 无法启动项目
系统信息:
vue/cli v4.1.2 yarn 1.22.4 package.json 依赖 "dependencies": { "@dcloudio/uni-app-plus": "^2.0.0-alpha-25120200103006", "@dcloudio/uni-h5": "^2.0.0-alpha-25120200103006", "@dcloudio/uni-helper-json": "", "@dcloudio/uni-mp-alipay": "^2.0.0-alpha-25120200103006", "@dcloudio/uni-mp-baidu": "^2.0.0-alpha-25120200103006", "@dcloudio/uni-mp-qq": "^2.0.0-alpha-25120200103006", "@dcloudio/uni-mp-toutiao": "^2.0.0-alpha-25120200103006", "@dcloudio/uni-mp-weixin": "^2.0.0-alpha-25120200103006", "@dcloudio/uni-stat": "^2.0.0-alpha-25120200103006", "core-js": "^3.6.4", "flyio": "^0.6.2", "regenerator-runtime": "^0.12.1", "vue": "^2.6.11", "vue-class-component": "^6.3.2", "vue-property-decorator": "^8.0.0", "vuex": "^3.0.1" }, "devDependencies": { "@babel/plugin-syntax-typescript": "^7.2.0", "@dcloudio/types": "", "@dcloudio/uni-cli-shared": "^2.0.0-alpha-25120200103006", "@dcloudio/uni-migration": "^2.0.0-alpha-25120200103006", "@dcloudio/uni-template-compiler": "^2.0.0-alpha-25120200103006", "@dcloudio/vue-cli-plugin-hbuilderx": "^2.0.0-alpha-25120200103006", "@dcloudio/vue-cli-plugin-uni": "^2.0.0-alpha-25120200103006", "@dcloudio/vue-cli-plugin-uni-optimize": "^2.0.0-alpha-25120200103006", "@dcloudio/webpack-uni-mp-loader": "^2.0.0-alpha-25120200103006", "@dcloudio/webpack-uni-pages-loader": "^2.0.0-alpha-25120200103006", "@vue/cli-plugin-babel": "^4.3.0", "@vue/cli-plugin-typescript": "", "@vue/cli-service": "^4.3.0", "babel-plugin-import": "^1.11.0", "mini-types": "", "miniprogram-api-typings": "*", "postcss-comment": "^2.0.0", "typescript": "^3.0.0", "vue-template-compiler": "^2.6.11" },