前端项目无法运行
来源:2-5 运行移动端和前端项目

BaBy_imooc
2022-03-31
cnpm install
前端项目时有提示信息
✔ Installed 20 packages
✔ Linked 0 latest versions
✔ Run 0 scripts
✔ All packages installed (used 52ms(network 48ms), speed 0B/s, json 0(0B), tarball 0B, manifests cache hit 0, etag hit 0 / miss 0)
baby@BaBydeMacBook-Pro emos-vue % cnpm install
⠸ [0/20] Installing vue-router@4.0.5
WARN node unsupported "node@v8.9.4" is incompatible with @vitejs/plugin-vue@1.2.1, expected node@>=12.0.0
WARN node unsupported "node@v8.9.4" is incompatible with less-loader@8.0.0, expected node@>= 10.13.0
WARN node unsupported "node@v8.9.4" is incompatible with sass-loader@11.0.1, expected node@>= 10.13.0
⠇ [8/20] Installing chokidar@>=2.0.0 <4.0.0
WARN node unsupported "node@v8.9.4" is incompatible with vite@2.1.5, expected node@>=12.0.0
⠋ [8/20] Installing bluebird@^3.7.2
WARN node unsupported "node@v8.9.4" is incompatible with sass@1.32.8 › chokidar@>=2.0.0 <4.0.0, expected node@>= 8.10.0
WARN node unsupported "node@v8.9.4" is incompatible with vite@2.1.5 › fsevents@~2.3.1, expected node@^8.16.0 || ^10.6.0 || >=11.0.0
⠙ [8/20] Installing source-map@^0.6.1
WARN node unsupported "node@v8.9.4" is incompatible with vite-plugin-svg-icons@0.4.1 › fs-extra@^9.1.0, expected node@>=10
WARN node unsupported "node@v8.9.4" is incompatible with @vue/compiler-sfc@3.0.11 › postcss@^8.1.10, expected node@^10 || ^12 || >=14
⠹ [8/20] Installing source-map-js@^1.0.2
WARN node unsupported "node@v8.9.4" is incompatible with vite-plugin-svg-icons@0.4.1 › svgo@^2.3.0, expected node@>=10.13.0
⠼ [10/20] Installing supports-preserve-symlinks-flag@^1.0.0
WARN node unsupported "node@v8.9.4" is incompatible with vite@2.1.5 › rollup@^2.38.5, expected node@>=10.0.0
⠴ [10/20] Installing html2canvas@^1.0.0-rc.5
WARN node unsupported "node@v8.9.4" is incompatible with sass@1.32.8 › chokidar@3.5.3 › readdirp@~3.6.0, expected node@>=8.10.0
⠦ [10/20] Installing fill-range@^7.0.1
WARN node unsupported "node@v8.9.4" is incompatible with vite-plugin-svg-icons@0.4.1 › fs-extra@9.1.0 › universalify@^2.0.0, expected node@>= 10.0.0
⠧ [10/20] Installing is-plain-obj@^1.1
WARN node unsupported "node@v8.9.4" is incompatible with vite-plugin-svg-icons@0.4.1 › svgo@2.8.0 › commander@^7.2.0, expected node@>= 10
WARN node unsupported "node@v8.9.4" is incompatible with @vue/compiler-sfc@3.0.11 › postcss@8.4.12 › nanoid@^3.3.1, expected node@^10 || ^12 || ^13.7 || ^14 || >=15.0.1
⠙ [10/20] Installing source-map@^0.6.1
WARN node unsupported "node@v8.9.4" is incompatible with vite-plugin-svg-icons@0.4.1 › svgo@2.8.0 › @trysound/sax@0.2.0, expected node@>=10.13.0
⠹ [10/20] Installing prr@~1.0.1
WARN node unsupported "node@v8.9.4" is incompatible with @vue/compiler-sfc@3.0.11 › postcss-modules@4.3.1 › postcss-modules-extract-imports@^3.0.0, expected node@^10 || ^12 || >= 14
WARN node unsupported "node@v8.9.4" is incompatible with @vue/compiler-sfc@3.0.11 › postcss-modules@4.3.1 › postcss-modules-values@^4.0.0, expected node@^10 || ^12 || >= 14
WARN node unsupported "node@v8.9.4" is incompatible with @vue/compiler-sfc@3.0.11 › postcss-modules@4.3.1 › postcss-modules-local-by-default@^4.0.0, expected node@^10 || ^12 || >= 14
WARN node unsupported "node@v8.9.4" is incompatible with @vue/compiler-sfc@3.0.11 › postcss-modules@4.3.1 › postcss-modules-scope@^3.0.0, expected node@^10 || ^12 || >= 14
⠇ [10/20] Installing ms@^2.1.1
WARN node unsupported "node@v8.9.4" is incompatible with jspdf@2.3.1 › canvg@^3.0.6, expected node@>=10.0.0
⠋ [10/20] Installing to-regex@^3.0.1
WARN node unsupported "node@v8.9.4" is incompatible with vite-plugin-svg-icons@0.4.1 › svg-baker@1.7.0 › posthtml-svg-mode@1.0.3 › posthtml-render@^1.0.6, expected node@>=10
⠹ [10/20] Installing isobject@^3.0.1
WARN node unsupported "node@v8.9.4" is incompatible with @vue/compiler-sfc@3.0.11 › postcss-modules@4.3.1 › generic-names@4.0.0 › loader-utils@^3.2.0, expected node@>= 12.13.0
⠦ [10/20] Installing @vue/reactivity@3.2.31
WARN node unsupported "node@v8.9.4" is incompatible with @vue/compiler-sfc@3.0.11 › postcss-modules@4.3.1 › postcss-modules-values@4.0.0 › icss-utils@^5.0.0, expected node@^10 || ^12 || >= 14
⠸ [12/20] Installing isobject@^3.0.1
WARN node unsupported "node@v8.9.4" is incompatible with jspdf@2.3.1 › canvg@3.0.10 › svg-pathdata@^6.0.3, expected node@>=12.0.0
✔ Installed 20 packages
✔ Linked 250 latest versions
[1/2] scripts.postinstall vite@2.1.5 › esbuild@^0.9.3 run "node install.js", root: "/Users/baby/Desktop/项目/SpringBoot+Vue3 项目实战,打造企业级在线办公系统/讲师源代码/202202os-vue/node_modules/_esbuild@0.9.7@esbuild"
[1/2] scripts.postinstall vite@2.1.5 › esbuild@^0.9.3 finished in 2s
[2/2] scripts.postinstall jspdf@2.3.1 › core-js@^3.6.0 run "node -e \"try{require('./postinstall')}catch(e){}\"", root: "/Users/baby/Desktop/项目/SpringBoot+Vue3 项目实战,打造统/讲师源代码/20220209/resource/项目/初始化项目/emos-vue/node_modules/_core-js@3.21.1@core-js"
Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!
The project needs your help! Please consider supporting of core-js:
> https://opencollective.com/core-js
> https://patreon.com/zloirock
> https://paypal.me/zloirock
> bitcoin: bc1qlea7544qtsmj2rayg0lthvza9fau63ux0fstcz
Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)
[2/2] scripts.postinstall jspdf@2.3.1 › core-js@^3.6.0 finished in 124ms
✔ Run 2 scripts
peerDependencies link vue@3.2.31 in /Users/baby/Desktop/项目/SpringBoot+Vue3 项目实战,打造企业级在线办公系统/讲师源代码/20220209/resource/项目/初始化项目/emos-vue/node_module@@vue/server-renderer unmet with /Users/baby/Desktop/项目/SpringBoot+Vue3 项目实战,打造企业级在线办公系统/讲师源代码/20220209/resource/项目/初始化项目/emos-vue/node_modules/v(3.0.3)
peerDependencies link postcss@5.2.18 in /Users/baby/Desktop/项目/SpringBoot+Vue3 项目实战,打造企业级在线办公系统/讲师源代码/20220209/resource/项目/初始化项目/emos-vue/node_mo@1.15.0@postcss-prefix-selector unmet with /Users/baby/Desktop/项目/SpringBoot+Vue3 项目实战,打造企业级在线办公系统/讲师源代码/20220209/resource/项目/初始化项目/emos-vue/node(8.4.12)
peerDependencies WARNING @vue/compiler-sfc@3.0.11 requires a peer of vue@3.0.11 but vue@3.0.3 was installed
peerDependencies WARNING element-plus@1.0.2-beta.42 requires a peer of vue@^3.0.9 but vue@3.0.3 was installed
peerDependencies WARNING less-loader@8.0.0 requires a peer of webpack@^5.0.0 but none was installed
peerDependencies WARNING sass-loader@11.0.1 requires a peer of fibers@>= 3.1.0 but none was installed
peerDependencies WARNING sass-loader@11.0.1 requires a peer of node-sass@^4.0.0 || ^5.0.0 but none was installed
peerDependencies WARNING sass-loader@11.0.1 requires a peer of webpack@^5.0.0 but none was installed
deprecate vite-plugin-svg-icons@0.4.1 › svg-baker@1.7.0 › micromatch@3.1.0 › snapdragon@0.8.2 › source-map-resolve@^0.5.0 See https://github.com/lydell/source-map-resolve#deprecated
deprecate vite-plugin-svg-icons@0.4.1 › svg-baker@1.7.0 › micromatch@3.1.0 › snapdragon@0.8.2 › source-map-resolve@0.5.3 › source-map-url@^0.4.0 See https://github.com/lydell/source-map-url#deprecated
deprecate vite-plugin-svg-icons@0.4.1 › svg-baker@1.7.0 › micromatch@3.1.0 › snapdragon@0.8.2 › source-map-resolve@0.5.3 › urix@^0.1.0 Please see https://github.com/lydell/urix#deprecated
deprecate vite-plugin-svg-icons@0.4.1 › svg-baker@1.7.0 › micromatch@3.1.0 › snapdragon@0.8.2 › source-map-resolve@0.5.3 › resolve-url@^0.2.1 https://github.com/lydell/resolve-url#deprecated
anti semver element-plus@1.0.2-beta.42 › dayjs@1.x delcares dayjs@1.x(resolved as 1.11.0) but using ancestor(root package.json)'s dependency dayjs@1.10.4(resolved as 1.10.4)
✔ All packages installed (293 packages installed from npm registry, used 12s(network 10s), speed 0B/s, json 0(0B), tarball 0B, manifests cache hit 250, etag hit 250 / miss 0)
运行npm rum dev
后报错
> emos-vue@0.0.0 dev /Users/baby/Desktop/emos-vue
> vite
/Users/baby/Desktop/emos-vue/node_modules/_vite@2.1.5@vite/dist/node/chunks/dep-66eb515d.js:3881
catch { }
^
SyntaxError: Unexpected token {
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:607:28)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
at Function.Module._load (module.js:491:3)
at Module.require (module.js:587:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/Users/baby/Desktop/emos-vue/node_modules/_vite@23)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! emos-vue@0.0.0 dev: `vite`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the emos-vue@0.0.0 dev 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/baby/.npm/_logs/2022-03-31T14_35_01_357Z-debug.log
写回答
1回答
-
神思者
2022-03-31
你犯了两个错误,前端项目路径不可以有中文,你的NodeJS版本不是最新的
00
相似问题