Linux Ubuntu Server 22.04 = Next JS och Docker
Hej
Jag har en Linux Server Ubuntu 22.04 med docker (Docker-Compose). Har skapat en app ArtikelStatus i Next JS där jag har laddat över hela projektet till roten av ArtikelStatus på Linuxserver. Jag labbar med samma struktur lokalt på datorn must i detta skede.
Lite generella funderingar:
Jag kör vill köra Yarn och inte npm. Tror att mitt problem vid prod build via "Next build" kommandot har att göra en konflikt mellan Yarn och NPM???
Vad jag vet behöver man den modulmappen för att allt ska fungera men Yarn är det inte istället för NPM????
Försöker jag nu bygga prod build med "next build" får jag felen nedan:
PS C:\Projekt - Lokalt\Artikelstatus> next build
- info Creating an optimized production build
- info Compiled successfully
./pages/ArtikelStatus.tsx
73:8 Warning: React Hook useEffect has a missing dependency: 'changeArticelList'. Either include it or remove the dependency array. react-hooks/exhaustive-deps
info - Need to disable some ESLint rules? Learn more here: https://nextjs.org/docs/basic-features/eslint#disabling-rules
- info Linting and checking validity of types
- info Collecting page data ..currentValueStateTree : {
articelStatus: {
isDataReceived: false,
appName: 'Artikelstatus',
headlines: [
'Artiklar:',
'Saldo:',
'Blocked New Sales Order',
'Blocked New Purchase Order'
],
listIndexes: { startIndex: 0, endIndex: 0 },
artList: [],
targetArticelObj: [ '', '..............', '..............', '..............' ],
paginationValue: { totPages: 0, currentPage: 1, quentityPages: 0 },
currentUrl: ''
}
}
{
isDataReceived: false,
appName: 'Artikelstatus',
headlines: [
'Artiklar:',
'Saldo:',
'Blocked New Sales Order',
'Blocked New Purchase Order'
],
listIndexes: { startIndex: 0, endIndex: 0 },
artList: [],
targetArticelObj: [ '', '..............', '..............', '..............' ],
paginationValue: { totPages: 0, currentPage: 1, quentityPages: 0 },
currentUrl: ''
}
currentValueStateTree : {
articelStatus: {
isDataReceived: false,
appName: 'Artikelstatus',
headlines: [
'Artiklar:',
'Saldo:',
'Blocked New Sales Order',
'Blocked New Purchase Order'
],
listIndexes: { startIndex: 0, endIndex: 0 },
artList: [],
targetArticelObj: [ '', '..............', '..............', '..............' ],
paginationValue: { totPages: 0, currentPage: 1, quentityPages: 0 },
currentUrl: ''
}
}
- info Collecting page data
[= ] - info Generating static pages (0/4)TypeError: Cannot read properties of null (reading 'useMemo')
at exports.useMemo (C:\Projekt - Lokalt\Artikelstatus\node_modules\react\cjs\react.production.min.js:25:208)
at Provider (C:\Projekt - Lokalt\Artikelstatus\node_modules\react-redux\lib\components\Provider.js:26:30)
at Wc (C:\Users\Fredrik.Hjarpe\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:68:44)
at Zc (C:\Users\Fredrik.Hjarpe\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:70:253)
at Z (C:\Users\Fredrik.Hjarpe\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:76:89)
at Zc (C:\Users\Fredrik.Hjarpe\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:70:481)
at Z (C:\Users\Fredrik.Hjarpe\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:76:89)
at $c (C:\Users\Fredrik.Hjarpe\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:78:98)
at bd (C:\Users\Fredrik.Hjarpe\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:77:404)
at Z (C:\Users\Fredrik.Hjarpe\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:76:217)
Error occurred prerendering page "/500". Read more: https://nextjs.org/docs/messages/prerender-error
TypeError: Cannot read properties of null (reading 'useMemo')
at exports.useMemo (C:\Projekt - Lokalt\Artikelstatus\node_modules\react\cjs\react.production.min.js:25:208)
at Provider (C:\Projekt - Lokalt\Artikelstatus\node_modules\react-redux\lib\components\Provider.js:26:30)
at Wc (C:\Users\Fredrik.Hjarpe\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:68:44)
at Zc (C:\Users\Fredrik.Hjarpe\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:70:253)
at Z (C:\Users\Fredrik.Hjarpe\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:76:89)
at Zc (C:\Users\Fredrik.Hjarpe\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:70:481)
at Z (C:\Users\Fredrik.Hjarpe\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:76:89)
at $c (C:\Users\Fredrik.Hjarpe\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:78:98)
at bd (C:\Users\Fredrik.Hjarpe\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:77:404)
at Z (C:\Users\Fredrik.Hjarpe\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:76:217)
TypeError: Cannot read properties of null (reading 'useMemo')
at exports.useMemo (C:\Projekt - Lokalt\Artikelstatus\node_modules\react\cjs\react.production.min.js:25:208)
at Provider (C:\Projekt - Lokalt\Artikelstatus\node_modules\react-redux\lib\components\Provider.js:26:30)
at Wc (C:\Users\Fredrik.Hjarpe\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:68:44)
at Zc (C:\Users\Fredrik.Hjarpe\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:70:253)
at Z (C:\Users\Fredrik.Hjarpe\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:76:89)
at Zc (C:\Users\Fredrik.Hjarpe\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:70:481)
at Z (C:\Users\Fredrik.Hjarpe\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:76:89)
at $c (C:\Users\Fredrik.Hjarpe\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:78:98)
at bd (C:\Users\Fredrik.Hjarpe\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:77:404)
at Z (C:\Users\Fredrik.Hjarpe\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:76:217)
Error occurred prerendering page "/404". Read more: https://nextjs.org/docs/messages/prerender-error
TypeError: Cannot read properties of null (reading 'useMemo')
at exports.useMemo (C:\Projekt - Lokalt\Artikelstatus\node_modules\react\cjs\react.production.min.js:25:208)
at Provider (C:\Projekt - Lokalt\Artikelstatus\node_modules\react-redux\lib\components\Provider.js:26:30)
at Wc (C:\Users\Fredrik.Hjarpe\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:68:44)
at Zc (C:\Users\Fredrik.Hjarpe\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:70:253)
at Z (C:\Users\Fredrik.Hjarpe\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:76:89)
at Zc (C:\Users\Fredrik.Hjarpe\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:70:481)
at Z (C:\Users\Fredrik.Hjarpe\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:76:89)
at $c (C:\Users\Fredrik.Hjarpe\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:78:98)
at bd (C:\Users\Fredrik.Hjarpe\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:77:404)
at Z (C:\Users\Fredrik.Hjarpe\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:76:217)
[ ==] - info Generating static pages (3/4)currentValueStateTree : {
articelStatus: {
isDataReceived: false,
appName: 'Artikelstatus',
headlines: [
'Artiklar:',
'Saldo:',
'Blocked New Sales Order',
'Blocked New Purchase Order'
],
listIndexes: { startIndex: 0, endIndex: 0 },
artList: [],
targetArticelObj: [ '', '..............', '..............', '..............' ],
paginationValue: { totPages: 0, currentPage: 1, quentityPages: 0 },
currentUrl: ''
}
}
{
isDataReceived: false,
appName: 'Artikelstatus',
headlines: [
'Artiklar:',
'Saldo:',
'Blocked New Sales Order',
'Blocked New Purchase Order'
],
listIndexes: { startIndex: 0, endIndex: 0 },
artList: [],
targetArticelObj: [ '', '..............', '..............', '..............' ],
paginationValue: { totPages: 0, currentPage: 1, quentityPages: 0 },
currentUrl: ''
}
currentValueStateTree : {
articelStatus: {
isDataReceived: false,
appName: 'Artikelstatus',
headlines: [
'Artiklar:',
'Saldo:',
'Blocked New Sales Order',
'Blocked New Purchase Order'
],
listIndexes: { startIndex: 0, endIndex: 0 },
artList: [],
targetArticelObj: [ '', '..............', '..............', '..............' ],
paginationValue: { totPages: 0, currentPage: 1, quentityPages: 0 },
currentUrl: ''
}
}
TypeError: Cannot read properties of null (reading 'useMemo')
at exports.useMemo (C:\Projekt - Lokalt\Artikelstatus\node_modules\react\cjs\react.production.min.js:25:208)
at Provider (C:\Projekt - Lokalt\Artikelstatus\node_modules\react-redux\lib\components\Provider.js:26:30)
at Wc (C:\Users\Fredrik.Hjarpe\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:68:44)
at Zc (C:\Users\Fredrik.Hjarpe\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:70:253)
at Z (C:\Users\Fredrik.Hjarpe\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:76:89)
at Zc (C:\Users\Fredrik.Hjarpe\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:70:481)
at Z (C:\Users\Fredrik.Hjarpe\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:76:89)
at $c (C:\Users\Fredrik.Hjarpe\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:78:98)
at bd (C:\Users\Fredrik.Hjarpe\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:77:404)
at Z (C:\Users\Fredrik.Hjarpe\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:76:217)
- info Generating static pages (4/4)
> Export encountered errors on following paths:
/ArtikelStatus
/_error: /404
/_error: /500
PS C:\Projekt - Lokalt\Artikelstatus>
.next mappen skapas så allt är fine så långt frånsett dessa fel ovan. Det är väl fel jag måste lösa för att en korrekt build kan skapas?
Kör jag samma med yarn build:
PS C:\Projekt - Lokalt\Artikelstatus> yarn build
yarn run v1.22.19
$ next build
- info Creating an optimized production build
- info Compiled successfully
./pages/ArtikelStatus.tsx
73:8 Warning: React Hook useEffect has a missing dependency: 'changeArticelList'. Either include it or remove the dependency array. react-hooks/exhaustive-deps
info - Need to disable some ESLint rules? Learn more here: https://nextjs.org/docs/basic-features/eslint#disabling-rules
- info Linting and checking validity of types
- info Collecting page data ...currentValueStateTree : {
articelStatus: {
isDataReceived: false,
appName: 'Artikelstatus',
headlines: [
'Artiklar:',
'Saldo:',
'Blocked New Sales Order',
'Blocked New Purchase Order'
],
listIndexes: { startIndex: 0, endIndex: 0 },
artList: [],
targetArticelObj: [ '', '..............', '..............', '..............' ],
paginationValue: { totPages: 0, currentPage: 1, quentityPages: 0 },
currentUrl: ''
}
}
{
isDataReceived: false,
appName: 'Artikelstatus',
headlines: [
'Artiklar:',
'Saldo:',
'Blocked New Sales Order',
'Blocked New Purchase Order'
],
listIndexes: { startIndex: 0, endIndex: 0 },
artList: [],
targetArticelObj: [ '', '..............', '..............', '..............' ],
paginationValue: { totPages: 0, currentPage: 1, quentityPages: 0 },
currentUrl: ''
}
currentValueStateTree : {
articelStatus: {
isDataReceived: false,
appName: 'Artikelstatus',
headlines: [
'Artiklar:',
'Saldo:',
'Blocked New Sales Order',
'Blocked New Purchase Order'
],
listIndexes: { startIndex: 0, endIndex: 0 },
artList: [],
targetArticelObj: [ '', '..............', '..............', '..............' ],
paginationValue: { totPages: 0, currentPage: 1, quentityPages: 0 },
currentUrl: ''
}
}
- info Collecting page data
[=== ] - info Generating static pages (3/4)currentValueStateTree : {
articelStatus: {
isDataReceived: false,
appName: 'Artikelstatus',
headlines: [
'Artiklar:',
'Saldo:',
'Blocked New Sales Order',
'Blocked New Purchase Order'
],
listIndexes: { startIndex: 0, endIndex: 0 },
artList: [],
targetArticelObj: [ '', '..............', '..............', '..............' ],
paginationValue: { totPages: 0, currentPage: 1, quentityPages: 0 },
currentUrl: ''
}
}
{
isDataReceived: false,
appName: 'Artikelstatus',
headlines: [
'Artiklar:',
'Saldo:',
'Blocked New Sales Order',
'Blocked New Purchase Order'
],
listIndexes: { startIndex: 0, endIndex: 0 },
artList: [],
targetArticelObj: [ '', '..............', '..............', '..............' ],
paginationValue: { totPages: 0, currentPage: 1, quentityPages: 0 },
currentUrl: ''
}
currentValueStateTree : {
articelStatus: {
isDataReceived: false,
appName: 'Artikelstatus',
headlines: [
'Artiklar:',
'Saldo:',
'Blocked New Sales Order',
'Blocked New Purchase Order'
],
listIndexes: { startIndex: 0, endIndex: 0 },
artList: [],
targetArticelObj: [ '', '..............', '..............', '..............' ],
paginationValue: { totPages: 0, currentPage: 1, quentityPages: 0 },
currentUrl: ''
}
}
currentValueStateTree : {
articelStatus: {
isDataReceived: false,
appName: 'Artikelstatus',
headlines: [
'Artiklar:',
'Saldo:',
'Blocked New Sales Order',
'Blocked New Purchase Order'
],
listIndexes: { startIndex: 0, endIndex: 0 },
artList: [],
targetArticelObj: [ '', '..............', '..............', '..............' ],
paginationValue: { totPages: 0, currentPage: 1, quentityPages: 0 },
currentUrl: ''
}
}
{
isDataReceived: false,
appName: 'Artikelstatus',
headlines: [
'Artiklar:',
'Saldo:',
'Blocked New Sales Order',
'Blocked New Purchase Order'
],
listIndexes: { startIndex: 0, endIndex: 0 },
artList: [],
targetArticelObj: [ '', '..............', '..............', '..............' ],
paginationValue: { totPages: 0, currentPage: 1, quentityPages: 0 },
currentUrl: ''
}
currentValueStateTree : {
articelStatus: {
isDataReceived: false,
appName: 'Artikelstatus',
headlines: [
'Artiklar:',
'Saldo:',
'Blocked New Sales Order',
'Blocked New Purchase Order'
],
listIndexes: { startIndex: 0, endIndex: 0 },
artList: [],
targetArticelObj: [ '', '..............', '..............', '..............' ],
paginationValue: { totPages: 0, currentPage: 1, quentityPages: 0 },
currentUrl: ''
}
}
{
isDataReceived: false,
appName: 'Artikelstatus',
headlines: [
'Artiklar:',
'Saldo:',
'Blocked New Sales Order',
'Blocked New Purchase Order'
],
listIndexes: { startIndex: 0, endIndex: 0 },
artList: [],
targetArticelObj: [ '', '..............', '..............', '..............' ],
paginationValue: { totPages: 0, currentPage: 1, quentityPages: 0 },
currentUrl: ''
}
- info Generating static pages (4/4)
- info Finalizing page optimization
Route (app) Size First Load JS
─ ○ /favicon.ico 0 B 0 B
+ First Load JS shared by all 0 B
Route (pages) Size First Load JS
┌ /_app 0 B 87.2 kB
├ ○ /404 181 B 87.4 kB
├ λ /api/ReqMSSQLData 0 B 87.2 kB
└ ○ /ArtikelStatus (1900 ms) 69.3 kB 157 kB
└ css/166457b338a809fe.css 326 B
+ First Load JS shared by all 87.2 kB
├ chunks/framework-9ba61dd7322f058e.js 45.2 kB
├ chunks/main-abf6f519ca6c0d4e.js 27.6 kB
├ chunks/pages/_app-2c4fc25184e39c45.js 12.6 kB
└ chunks/webpack-5ad9183e2cf56257.js 1.73 kB
λ (Server) server-side renders at runtime (uses getInitialProps or getServerSideProps)
○ (Static) automatically rendered as static HTML (uses no initial props)
Done in 41.94s.
PS C:\Projekt - Lokalt\Artikelstatus>
Får jag inga fel
Både Node och Yarn är uppdaterade.
Testar jag i skrivande stund att köra "yarn dev" fungerar inte appen. Felet nedan kommer upp:
PS C:\Projekt - Lokalt\Artikelstatus> yarn dev
Internal Error: articelstatus@workspace:.: This package doesn't seem to be present in your lockfile; run "yarn install" to update the lockfile
at V0.getCandidates (C:\Projekt - Lokalt\Artikelstatus\.yarn\releases\yarn-3.6.3.cjs:435:5145)
at kf.getCandidates (C:\Projekt - Lokalt\Artikelstatus\.yarn\releases\yarn-3.6.3.cjs:391:1264)
at C:\Projekt - Lokalt\Artikelstatus\.yarn\releases\yarn-3.6.3.cjs:439:8033
at df (C:\Projekt - Lokalt\Artikelstatus\.yarn\releases\yarn-3.6.3.cjs:390:11070)
at ge (C:\Projekt - Lokalt\Artikelstatus\.yarn\releases\yarn-3.6.3.cjs:439:8013)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Promise.allSettled (index 0)
at async io (C:\Projekt - Lokalt\Artikelstatus\.yarn\releases\yarn-3.6.3.cjs:390:10398)
at async C:\Projekt - Lokalt\Artikelstatus\.yarn\releases\yarn-3.6.3.cjs:439:8545
at async ti.startProgressPromise (C:\Projekt - Lokalt\Artikelstatus\.yarn\releases\yarn-3.6.3.cjs:390:47579)
PS C:\Projekt - Lokalt\Artikelstatus>
Med Yarn v1.22.19 fungerar detta men i Yarn v3.6.3 tas mappen "node_modules" bort ifall jag kör "yarn install". Filem "yarn.lock" skapas och behöver finnas vid körning av Yarn!
Kör jag nu "yarn dev" körs appen men alla mina modulen för felet
"Cannot find module '@mui/icons-material/ArrowForward' or its corresponding type declarations". Verkar dock vara ett Typ fel då appen fungerar???
Kör jag "next build" får jag felen:
PS C:\Projekt - Lokalt\Artikelstatus> next build
Failed to compile.
./app/layout.tsx
Module not found: Can't resolve 'react/jsx-runtime'
https://nextjs.org/docs/messages/module-not-found
Import trace for requested module:
./pages/_app.tsx
./data/ArticelSearch.tsx
Module not found: Can't resolve 'react/jsx-runtime'
https://nextjs.org/docs/messages/module-not-found
Import trace for requested module:
./pages/ArtikelStatus.tsx
./data/ArticelSearch.tsx
Module not found: Can't resolve '@mui/joy/FormControl'
https://nextjs.org/docs/messages/module-not-found
Import trace for requested module:
./pages/ArtikelStatus.tsx
./data/ArticelSearch.tsx
Module not found: Can't resolve '@mui/joy/Input'
https://nextjs.org/docs/messages/module-not-found
Import trace for requested module:
./pages/ArtikelStatus.tsx
./data/CalApiSQLData.ts
Module not found: Can't resolve 'axios'
https://nextjs.org/docs/messages/module-not-found
Import trace for requested module:
./pages/ArtikelStatus.tsx
> Build failed because of webpack errors
- info Creating an optimized production build .
PS C:\Projekt - Lokalt\Artikelstatus>
Vi tar en sak i taget men jag verkar ha flera fel här, inte sant?
Mvh Fredrik
Computer: Windows 11, 64-bit, Intel 285k, MSI MEG Z890 Ace, 64GB RAM,
MSI GeForce RTX 5080 16GB Vanguard SOC Launch