简体   繁体   English

next.js with-mongodb 构建错误。 `下一个构建`的错误?

[英]next.js with-mongodb build error. error on `next build`?

I am trying to build a next.js project with-mongodb on it but its not working and im not sure why.我正在尝试构建一个带有-mongodb 的 next.js 项目,但它不工作,我不知道为什么。 The log doesn't appear to be very helpful with that the issue is (as far as i can tell) and so im not sure how to fix it.日志似乎对这个问题没有太大帮助(据我所知),所以我不知道如何解决它。 here is a copy of the log;这是日志的副本;

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'run',
1 verbose cli   'build'
1 verbose cli ]
2 info using npm@6.14.9
3 info using node@v14.15.3
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle with-mongodb@0.1.0~prebuild: with-mongodb@0.1.0
6 info lifecycle with-mongodb@0.1.0~build: with-mongodb@0.1.0
7 verbose lifecycle with-mongodb@0.1.0~build: unsafe-perm in lifecycle true
8 verbose lifecycle with-mongodb@0.1.0~build: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;E:\Creative\Programming\VS code\quote-db\node_modules\.bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files\Oculus\Support\oculus-runtime;C:\Python39\Scripts\;C:\Python39\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\PuTTY\;C:\ProgramData\chocolatey\bin;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Calibre2\;C:\Program Files\nodejs\;C:\Program Files (x86)\Touch Portal\plugins\adb\platform-tools;C:\Program Files\Git\cmd;C:\Users\user_\AppData\Local\Microsoft\WindowsApps;C:\Users\user_\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\user_\AppData\Roaming\npm
9 verbose lifecycle with-mongodb@0.1.0~build: CWD: E:\Creative\Programming\VS code\quote-db
10 silly lifecycle with-mongodb@0.1.0~build: Args: [ '/d /s /c', 'next build' ]
11 silly lifecycle with-mongodb@0.1.0~build: Returned: code: 1  signal: null
12 info lifecycle with-mongodb@0.1.0~build: Failed to exec build script
13 verbose stack Error: with-mongodb@0.1.0 build: `next build`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (C:\Program Files\nodejs\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> (C:\Program Files\nodejs\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:1048:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
14 verbose pkgid with-mongodb@0.1.0
15 verbose cwd E:\Creative\Programming\VS code\quote-db
16 verbose Windows_NT 10.0.18363
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "build"
18 verbose node v14.15.3
19 verbose npm  v6.14.9
20 error code ELIFECYCLE
21 error errno 1
22 error with-mongodb@0.1.0 build: `next build`
22 error Exit status 1
23 error Failed at the with-mongodb@0.1.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 ]

EDIT: here is my package.json file.编辑:这是我的package.json文件。

{
  "name": "with-mongodb",
  "version": "0.1.0",
  "scripts": {
    "debug": "cross-env NODE_OPTIONS='--inspect' next dev",
    "dev": "next dev",
    "build": "next build",
    "start": "next start"
  },
  "dependencies": {
    "cross-env": "^7.0.3",
    "mongodb": "^3.5.9",
    "next": "latest",
    "postcss-flexbugs-fixes": "^5.0.2",
    "postcss-import": "^14.0.0",
    "postcss-preset-env": "^6.7.0",
    "precss": "^4.0.0",
    "react": "^16.13.1",
    "react-dom": "^16.13.1",
    "sass": "^1.32.8",
    "swr": "^0.4.2",
    "tailwindcss": "^2.0.3"
  },
  "license": "MIT"
}

Today I tried again and recieved a proper error message.今天我再次尝试并收到了正确的错误消息。

ModuleNotFoundError: Module not found: Error: Can't resolve '../styles/main.module.scss' in 'E:\Creative\Programming\VS code\quote-db\pages'

I'm not sure what changed, but this is now solved.我不确定发生了什么变化,但现在已经解决了。 Presumably restarting my PC had something to do with it?大概重启我的电脑与它有关?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM