dotnet-architecture / eShopOnContainers

Cross-platform .NET sample microservices and container based application that runs on Linux Windows and macOS. Powered by .NET 7, Docker Containers and Azure Kubernetes Services. Supports Visual Studio, VS for Mac and CLI based environments with Docker CLI, dotnet CLI, VS Code or any other code editor. Moved to https://github.com/dotnet/eShop.

Home Page:https://dot.net/architecture

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

main branch build issue

PP1King opened this issue · comments

Hi,
i downloaded the main branch and tried to build it with sudo docker compose build.
I got the following error message:

=> [internal] load build definition from Dockerfile 0.1s
=> => transferring dockerfile: 5.35kB 0.1s
=> [internal] load .dockerignore 0.1s
=> => transferring context: 354B 0.0s
=> [internal] load metadata for mcr.microsoft.com/dotnet/core/sdk:3.1 0.1s
=> [internal] load metadata for mcr.microsoft.com/dotnet/core/aspnet:3.1 0.1s
=> [internal] load metadata for docker.io/library/node:10.13 1.7s
=> [build 1/42] FROM mcr.microsoft.com/dotnet/core/sdk:3.1@sha256:150d074697d1cda38a0c2185fe43895d84b5745841e9d15c5adba29604a6e4cb 0.0s
=> [base 1/2] FROM mcr.microsoft.com/dotnet/core/aspnet:3.1@sha256:e3b773f30a0a6e88d71ce52429f6847627fc9353e491346902ca345760b82bdd 0.0s
=> CACHED [final 1/2] WORKDIR /app 0.0s
=> CACHED [base 2/2] WORKDIR /app 0.0s
=> [internal] load build context 0.2s
=> => transferring context: 117.79kB 0.2s
=> [node-build 1/6] FROM docker.io/library/node:10.13@sha256:dc724f69561cc8e1437bda5ca0f1c88541ae1794dbd5a392abacf1166c4b0393 0.0s
=> CACHED [node-build 2/6] WORKDIR /web 0.0s
=> CACHED [node-build 3/6] COPY Web/WebSPA/package.json . 0.0s
=> CACHED [node-build 4/6] COPY Web/WebSPA/package-lock.json . 0.0s
=> CACHED [node-build 5/6] COPY Web/WebSPA . 0.0s
=> CANCELED [node-build 6/6] RUN npm i npm@latest -g && npm update && npm install && npm run build:prod 8.2s
failed to solve: process "/bin/sh -c dotnet publish --no-restore -c Release -o /app" did not complete successfully: exit code: 1

I am using Ubuntu 22.04.
Can someone help me?

Hi @PP1King, thanks for sharing your query here. There seems to be some error while building WebSPA project, can you ensure you have the node and npm installed rightly?

Are you able to resolve the issue?

Hi,
thank you for the answer. I was on vacation last week.
Both node and npm are correct installed on my Ubuntu.

I build only the webspa and there comes a different error message:

sudo docker compose build webspa

[node-build 6/6] RUN npm i npm@latest -g && npm update && npm install && npm run build:prod:
#0 18.16 /usr/local/bin/npx -> /usr/local/lib/node_modules/npm/bin/npx-cli.js
#0 18.16 /usr/local/bin/npm -> /usr/local/lib/node_modules/npm/bin/npm-cli.js
#0 18.23 + npm@9.6.2
#0 18.23 added 112 packages from 35 contributors, removed 262 packages and updated 125 packages in 15.547s
#0 18.33 ERROR: npm v9.6.2 is known not to run on Node.js v10.13.0. You'll need to upgrade
#0 18.33 to a newer Node.js version in order to use this version of npm. This version of
#0 18.33 npm supports the following node versions: ^14.17.0 || ^16.13.0 || >=18.0.0. You
#0 18.33 can find the latest version at https://nodejs.org/.
#0 18.33
#0 18.33 ERROR:
#0 18.33 /usr/local/lib/node_modules/npm/lib/utils/exit-handler.js:21
#0 18.33 const hasLoadedNpm = npm?.config.loaded
#0 18.33 ^
#0 18.33
#0 18.33 SyntaxError: Unexpected token .
#0 18.33 at new Script (vm.js:79:7)
#0 18.33 at createScript (vm.js:251:10)
#0 18.33 at Object.runInThisContext (vm.js:303:10)
#0 18.33 at Module._compile (internal/modules/cjs/loader.js:656:28)
#0 18.33 at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
#0 18.33 at Module.load (internal/modules/cjs/loader.js:598:32)
#0 18.33 at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
#0 18.33 at Function.Module._load (internal/modules/cjs/loader.js:529:3)
#0 18.33 at Module.require (internal/modules/cjs/loader.js:636:17)
#0 18.33 at require (internal/modules/cjs/helpers.js:20:18)


failed to solve: process "/bin/sh -c npm i npm@latest -g && npm update && npm install && npm run build:prod" did not complete successfully: exit code: 1

It look like the new npm version doesn't work with the old node version.
Have you any idea how it can be fixed?

You have to install the latest version of npm and node. Please ensure you have the latest or below version installed:

PS C:\Users\xxxxxx> npm -v
9.5.1
PS C:\Users\xxxxx> node -v
v16.13.2

Install n
npm install -g n
You'll need to install this package globally as it manages the Node versions at the root.

Install a new version of Node

n lts

How to Update NPM?
Just as you use NPM to update packages, you can use NPM to update itself. Here's the command to achieve this:

npm install -g npm@latest

I hope it helps.

I am closing this issue. Please continue the conversation or reopen it if you want more help.