如何成功运行npm运行构建而不出现nuxt构建错误

时间:2020-10-25 18:23:05

标签: javascript node.js npm webpack nuxt.js

我对Nuxt构建错误有疑问。我能够运行npm run de v,并且我的本地主机服务器运行没有任何问题,但是当我尝试npm run build时,出现了这种错误: 我先谢谢你,祝你有美好的一天

│                             │
   │   ✖ Nuxt Fatal Error        │
   │                             │
   │   Error: Nuxt build error   │
   │                             │
   ╰─────────────────────────────╯

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! pravoPress@1.0.0 build: `nuxt build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the pravoPress@1.0.0 build 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/martinchalupa/.npm/_logs/2020-10-25T18_11_11_897Z-debug.log
martinchalupa@Martins-MacBook-Pro pravoPress %

上面还有更多代码:

 FATAL  Nuxt build error                                              19:11:11

  at WebpackBundler.webpackCompile (node_modules/@nuxt/webpack/dist/webpack.js:5351:21)
  at processTicksAndRejections (internal/process/task_queues.js:97:5)
  at async WebpackBundler.build (node_modules/@nuxt/webpack/dist/webpack.js:5300:5)
  at async Builder.build (node_modules/@nuxt/builder/dist/builder.js:5602:5)
  at async Object.run (node_modules/@nuxt/cli/dist/cli-build.js:104:7)
  at async NuxtCommand.run (node_modules/@nuxt/cli/dist/cli-index.js:2759:7)

还有更多与此类似的消息。我想这可能与Nuxt的Nuxt和tailwind模块有关。

ERROR in ./components/partials/TopButtonAdvertisements.vue?vue&type=style&index=0&id=80cb5a22&scoped=true&lang=css& (./node_modules/css-loader/dist/cjs.js??ref--3-oneOf-1-1!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src??ref--3-oneOf-1-2!./node_modules/vue-loader/lib??vue-loader-options!./components/partials/TopButtonAdvertisements.vue?vue&type=style&index=0&id=80cb5a22&scoped=true&lang=css&)
Module build failed (from ./node_modules/postcss-loader/src/index.js):
TypeError: Class constructor extractor cannot be invoked without 'new'
    at m (/Users/martinchalupa/Web/projects/PravoPress/pravoPress/node_modules/purgecss/lib/purgecss.js:1:3211)
    at x.extractSelectorsFromFiles (/Users/martinchalupa/Web/projects/PravoPress/pravoPress/node_modules/purgecss/lib/purgecss.js:1:5234)
    at async /Users/martinchalupa/Web/projects/PravoPress/pravoPress/node_modules/@fullhuman/postcss-purgecss/lib/postcss-purgecss.js:1:549
 @ ./components/partials/TopButtonAdvertisements.vue?vue&type=style&index=0&id=80cb5a22&scoped=true&lang=css& (./node_modules/vue-style-loader??ref--3-oneOf-1-0!./node_modules/css-loader/dist/cjs.js??ref--3-oneOf-1-1!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src??ref--3-oneOf-1-2!./node_modules/vue-loader/lib??vue-loader-options!./components/partials/TopButtonAdvertisements.vue?vue&type=style&index=0&id=80cb5a22&scoped=true&lang=css&) 4:14-362
 @ ./components/partials/TopButtonAdvertisements.vue?vue&type=style&index=0&id=80cb5a22&scoped=true&lang=css&
 @ ./components/partials/TopButtonAdvertisements.vue
 @ ./node_modules/babel-loader/lib??ref--2-0!./node_modules/vue-loader/lib??vue-loader-options!./components/advertisements/seekings/SeekingBlock.vue?vue&type=script&lang=js&
 @ ./components/advertisements/seekings/SeekingBlock.vue?vue&type=script&lang=js&
 @ ./components/advertisements/seekings/SeekingBlock.vue
 @ ./node_modules/babel-loader/lib??ref--2-0!./node_modules/vue-loader/lib??vue-loader-options!./pages/advertisements/index/job-seekings.vue?vue&type=script&lang=js&
 @ ./pages/advertisements/index/job-seekings.vue?vue&type=script&lang=js&
 @ ./pages/advertisements/index/job-seekings.vue
 @ ./.nuxt/router.js
 @ ./.nuxt/index.js
 @ ./.nuxt/client.js
 @ multi ./.nuxt/client.js

提及的debug.log:

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   '/usr/local/Cellar/node/14.1.0/bin/node',
1 verbose cli   '/usr/local/bin/npm',
1 verbose cli   'run',
1 verbose cli   'build'
1 verbose cli ]
2 info using npm@6.14.4
3 info using node@v14.1.0
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle pravoPress@1.0.0~prebuild: pravoPress@1.0.0
6 info lifecycle pravoPress@1.0.0~build: pravoPress@1.0.0
7 verbose lifecycle pravoPress@1.0.0~build: unsafe-perm in lifecycle true
8 verbose lifecycle pravoPress@1.0.0~build: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/martinchalupa/Web/projects/PravoPress/pravoPress/node_modules/.bin:/Applications/mampstack-7.3.10-0/mysql/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Library/Apple/bin
9 verbose lifecycle pravoPress@1.0.0~build: CWD: /Users/martinchalupa/Web/projects/PravoPress/pravoPress
10 silly lifecycle pravoPress@1.0.0~build: Args: [ '-c', 'nuxt build' ]
11 silly lifecycle pravoPress@1.0.0~build: Returned: code: 1  signal: null
12 info lifecycle pravoPress@1.0.0~build: Failed to exec build script
13 verbose stack Error: pravoPress@1.0.0 build: `nuxt build`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:315:20)
13 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:315:20)
13 verbose stack     at maybeClose (internal/child_process.js:1051:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5)
14 verbose pkgid pravoPress@1.0.0
15 verbose cwd /Users/martinchalupa/Web/projects/PravoPress/pravoPress
16 verbose Darwin 19.6.0
17 verbose argv "/usr/local/Cellar/node/14.1.0/bin/node" "/usr/local/bin/npm" "run" "build"
18 verbose node v14.1.0
19 verbose npm  v6.14.4
20 error code ELIFECYCLE
21 error errno 1
22 error pravoPress@1.0.0 build: `nuxt build`
22 error Exit status 1
23 error Failed at the pravoPress@1.0.0 build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

1 个答案:

答案 0 :(得分:0)

我已经重新安装了Nuxt项目,并且一切正常