Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker build error #204

Open
jiftle opened this issue Nov 1, 2022 · 1 comment
Open

docker build error #204

jiftle opened this issue Nov 1, 2022 · 1 comment

Comments

@jiftle
Copy link

jiftle commented Nov 1, 2022

os:
[Release]
Version=20.7.1
Type=Desktop
Type[zh_CN]=社区版
Edition=Y2020E0001
Copyright=Y2020CR001
[Addition]
Milestone=
Buildid=build1

error

 docker build ./ -t t
Sending build context to Docker daemon  466.3MB
Step 1/11 : FROM registry.cn-shanghai.aliyuncs.com/lwmeng/node:lts-alpine as build-stage
lts-alpine: Pulling from lwmeng/node
0a6724ff3fcd: Pull complete 
9383f33fa9f3: Pull complete 
b6ae88d676fe: Pull complete 
565e01e00588: Pull complete 
Digest: sha256:bef791f512bb4c3051a1210d7fbd58206538f41eea9b966031abc8a7453308fe
Status: Downloaded newer image for registry.cn-shanghai.aliyuncs.com/lwmeng/node:lts-alpine
 ---> 51d926a5599d
Step 2/11 : WORKDIR /app
 ---> Running in ae7236339dd9
Removing intermediate container ae7236339dd9
 ---> 8f26a77c0e1b
Step 3/11 : COPY package*.json ./
 ---> 70846eea7e50
Step 4/11 : RUN npm install -g cnpm --registry=https://registry.npmmirror.com
 ---> Running in 36ba2a281ae1
/usr/local/bin/cnpm -> /usr/local/lib/node_modules/cnpm/bin/cnpm
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">= 14.17.0"} (current: {"node":"14.15.3","npm":"6.14.9"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]                                                                                                
                                                                                                                                                                          
+ [email protected]                                                                                                                                                              
added 572 packages from 205 contributors in 27.979s
Removing intermediate container 36ba2a281ae1
 ---> 5751c2a0bee7
Step 5/11 : RUN cnpm install
 ---> Running in 4648c7177199
internal/modules/cjs/loader.js:883
  throw err;                                                                                                                                                              
  ^                                                                                                                                                                       
                                                                                                                                                                          
Error: Cannot find module 'diagnostics_channel'                                                                                                                           
Require stack:                                                                                                                                                            
- /usr/local/lib/node_modules/cnpm/node_modules/urllib/src/cjs/diagnosticsChannel.js                                                                                      
- /usr/local/lib/node_modules/cnpm/node_modules/urllib/src/cjs/HttpClient.js                                                                                              
- /usr/local/lib/node_modules/cnpm/node_modules/urllib/src/cjs/index.js                                                                                                   
- /usr/local/lib/node_modules/cnpm/node_modules/npminstall/lib/get.js                                                                                                     
- /usr/local/lib/node_modules/cnpm/node_modules/npminstall/lib/utils.js                                                                                                   
- /usr/local/lib/node_modules/cnpm/node_modules/npminstall/lib/local_install.js                                                                                           
- /usr/local/lib/node_modules/cnpm/node_modules/npminstall/lib/index.js                                                                                                   
- /usr/local/lib/node_modules/cnpm/node_modules/npminstall/bin/install.js                                                                                                 
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)                                                                                           
    at Function.Module._load (internal/modules/cjs/loader.js:725:27)                                                                                                      
    at Module.require (internal/modules/cjs/loader.js:952:19)                                                                                                             
    at require (internal/modules/cjs/helpers.js:88:18)                                                                                                                    
    at Object.<anonymous> (/usr/local/lib/node_modules/cnpm/node_modules/urllib/src/cjs/diagnosticsChannel.js:5:55)                                                       
    at Module._compile (internal/modules/cjs/loader.js:1063:30)                                                                                                           
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)                                                                                             
    at Module.load (internal/modules/cjs/loader.js:928:32)                                                                                                                
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)                                                                                                      
    at Module.require (internal/modules/cjs/loader.js:952:19) {                                                                                                           
  code: 'MODULE_NOT_FOUND',                                                                                                                                               
  requireStack: [                                                                                                                                                         
    '/usr/local/lib/node_modules/cnpm/node_modules/urllib/src/cjs/diagnosticsChannel.js',                                                                                 
    '/usr/local/lib/node_modules/cnpm/node_modules/urllib/src/cjs/HttpClient.js',                                                                                         
    '/usr/local/lib/node_modules/cnpm/node_modules/urllib/src/cjs/index.js',                                                                                              
    '/usr/local/lib/node_modules/cnpm/node_modules/npminstall/lib/get.js',                                                                                                
    '/usr/local/lib/node_modules/cnpm/node_modules/npminstall/lib/utils.js',                                                                                              
    '/usr/local/lib/node_modules/cnpm/node_modules/npminstall/lib/local_install.js',                                                                                      
    '/usr/local/lib/node_modules/cnpm/node_modules/npminstall/lib/index.js',                                                                                              
    '/usr/local/lib/node_modules/cnpm/node_modules/npminstall/bin/install.js'                                                                                             
  ]                                                                                                                                                                       
}                                                                                                                                                                         
The command '/bin/sh -c cnpm install' returned a non-zero code: 1 
@wanghao-bianjie
Copy link

修改 dockerfile 文件:

FROM registry.cn-shanghai.aliyuncs.com/lwmeng/node:lts-alpine as build-stage
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build:prod

FROM registry.cn-shanghai.aliyuncs.com/lwmeng/nginx
COPY --from=build-stage /app/dist /usr/share/nginx/html

EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants