部署应用程序时找不到多个模块-ibm云

问题描述 投票:0回答:1

我正在尝试部署我的应用程序,但始终无法在IBM cloud CI / CD上运行。我的问题是总是找不到某些模块。找不到的模块列表(安装前一个模块时,每次出现一次)如下:

  1. 深度
  2. 合并描述符
  3. 最终处理者
  4. 调试
  5. encodeurl
  6. escape-html
  7. esm

等...

这继续进行,但我没有继续安装更多丢失的npm软件包。

    {
      "name": "MERN_1",
      "version": "1.1.0",
      "description": "MERN App",
      "private": true,
      "engines": {
        "node": "^8.11.1"
      },
      "scripts": {
        "start": "node server/server.js",
        "debug": "nf --procfile Procfile-debug --port 3000 start",
        "debug:legacy": "node --debug=0.0.0.0:5858 server/server.js",
        "test": "nyc mocha --exit",
        "dev": "nf --procfile Procfile-dev --port 3000 start",
        "build": "webpack --progress --config webpack.prod.js",
        "postinstall": "npm run build",
        "lint": "eslint src",
        "client-reload": "webpack-dev-server --host 0.0.0.0  --history-api-fallback --progress --inline --config webpack.dev-standalone.js",
        "server-reload": "nodemon server/server.js"
      },
      "nodemonConfig": {
        "env": {
          "NODE_HEAPDUMP_OPTIONS": "nosignal"
        }
      },
      "dependencies": {
        "@material-ui/lab": "^4.0.0-alpha.23",
        "@sendgrid/mail": "^6.4.0",
        "bcrypt": "^3.0.6",
        "body-parser": "^1.19.0",
        "clone-deep": "^4.0.1",
        "config": "^3.2.2",
        "connect-mongo": "^1.3.2",
        "dotenv": "^8.0.0",
        "eslint": "^6.1.0",
        "express": "^4.17.1",
        "express-session": "^1.16.2",
        "jsonwebtoken": "^8.5.1",
        "log4js": "^3.0.5",
        "moment": "^2.24.0",
        "mongoose": "^4.13.19",
        "request": "^2.88.0"
      },
      "devDependencies": {
        "@babel/core": "^7.5.5",
        "@babel/helper-create-class-features-plugin": "^7.5.5",
        "@babel/plugin-proposal-class-properties": "^7.5.5",
        "@babel/preset-env": "^7.5.5",
        "@babel/preset-react": "^7.0.0",
        "@material-ui/core": "^4.3.2",
        "@material-ui/icons": "^4.1.0",
        "array-move": "^2.1.0",
        "axios": "^0.18.1",
        "babel-loader": "^8.0.0",
        "chai": "^4.0.0",
        "copy-webpack-plugin": "^4.5.1",
        "css-loader": "^3.2.0",
        "foreman": "^3.0.1",
        "history": "^4.9.0",
        "html-webpack-plugin": "^3.2.0",
        "mocha": "^5.2.0",
        "node-sass": "^4.8.3",
        "nodemon": "^1.12.1",
        "nyc": "^14.1.1",
        "react": "^16.9.0",
        "react-dom": "^16.9.0",
        "react-redux": "^6.0.1",
        "react-router-dom": "^5.0.0",
        "react-sortable-hoc": "^1.9.1",
        "react-virtualized": "^9.21.1",
        "redux": "^4.0.4",
        "redux-thunk": "^2.3.0",
        "sass-loader": "^7.2.0",
        "style-loader": "^0.21.0",
        "webpack": "^4.39.2",
        "webpack-cli": "^3.3.6",
        "webpack-dev-server": "^3.8.0",
        "webpack-merge": "^4.1.1"
      }
    }

[当我尝试使用控制台(如git push)通过ibm工具链推送完全相同的项目时,它说无法部署该应用程序,并且在检查日志时发现模块未找到错误。这是日志的副本:

     2019-10-14T12:32:37.70-0400 [APP/PROC/WEB/0] OUT found 0 vulnerabilities
       2019-10-14T12:32:38.08-0400 [APP/PROC/WEB/0] OUT > [email protected] start /home/vcap/app
       2019-10-14T12:32:38.08-0400 [APP/PROC/WEB/0] OUT > node server/server.js
       2019-10-14T12:32:38.19-0400 [APP/PROC/WEB/0] ERR module.js:550
       2019-10-14T12:32:38.19-0400 [APP/PROC/WEB/0] ERR     throw err;
       2019-10-14T12:32:38.19-0400 [APP/PROC/WEB/0] ERR     ^
       2019-10-14T12:32:38.19-0400 [APP/PROC/WEB/0] ERR Error: Cannot find module 'merge-descriptors'
       2019-10-14T12:32:38.19-0400 [APP/PROC/WEB/0] ERR     at Function.Module._resolveFilename (module.js:548:15)
       2019-10-14T12:32:38.19-0400 [APP/PROC/WEB/0] ERR     at Function.Module._load (module.js:475:25)
       2019-10-14T12:32:38.19-0400 [APP/PROC/WEB/0] ERR     at Module.require (module.js:597:17)
       2019-10-14T12:32:38.19-0400 [APP/PROC/WEB/0] ERR     at require (internal/module.js:11:18)
       2019-10-14T12:32:38.19-0400 [APP/PROC/WEB/0] ERR     at Object.<anonymous> (/home/vcap/deps/0/node_modules/express/lib/express.js:17:13)
       2019-10-14T12:32:38.19-0400 [APP/PROC/WEB/0] ERR     at Module._compile (module.js:653:30)
       2019-10-14T12:32:38.19-0400 [APP/PROC/WEB/0] ERR     at Object.Module._extensions..js (module.js:664:10)
       2019-10-14T12:32:38.19-0400 [APP/PROC/WEB/0] ERR     at Module.load (module.js:566:32)
       2019-10-14T12:32:38.19-0400 [APP/PROC/WEB/0] ERR     at tryModuleLoad (module.js:506:12)
       2019-10-14T12:32:38.19-0400 [APP/PROC/WEB/0] ERR     at Function.Module._load (module.js:498:3)
       2019-10-14T12:32:38.20-0400 [APP/PROC/WEB/0] ERR npm ERR! code ELIFECYCLE
       2019-10-14T12:32:38.20-0400 [APP/PROC/WEB/0] ERR npm ERR! errno 1
       2019-10-14T12:32:38.20-0400 [APP/PROC/WEB/0] ERR npm ERR! [email protected] start: `node server/server.js`
       2019-10-14T12:32:38.20-0400 [APP/PROC/WEB/0] ERR npm ERR! Exit status 1
       2019-10-14T12:32:38.21-0400 [APP/PROC/WEB/0] ERR npm ERR! 
       2019-10-14T12:32:38.21-0400 [APP/PROC/WEB/0] ERR npm ERR! Failed at the [email protected] start script.
       2019-10-14T12:32:38.21-0400 [APP/PROC/WEB/0] ERR npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
       2019-10-14T12:32:38.21-0400 [APP/PROC/WEB/0] ERR npm ERR! A complete log of this run can be found in:
       2019-10-14T12:32:38.21-0400 [APP/PROC/WEB/0] ERR npm ERR!     /home/vcap/app/.npm/_logs/2019-10-14T16_32_38_212Z-debug.log
       2019-10-14T12:32:38.27-0400 [APP/PROC/WEB/0] OUT Exit status 1
       2019-10-14T12:32:38.28-0400 [CELL/SSHD/0] OUT Exit status 0

[当我尝试使用ibmcloud登录进行推送时,将--cf和cf push作为目标,则该应用程序已成功推送。我不确定错误来自何处,因为我想继续通过工具链使用git push命令进行部署。

请参见manifest.yml文件以下:

       applications:
    - buildpacks: ['sdk-for-nodejs']
      command: npm prune --production && NODE_ENV=production npm start
      domain: null
      env:
        NPM_CONFIG_PRODUCTION: false
        NODE_MODULES_CACHE: false
      host: null
      instances: 1
      memory: 256M
      name: mern_1
      timeout: 360
    domain: null
    host: null

我还尝试安装具有相同项目配置的新工具链,但同样失败。

谁能帮我解决这个问题?

node.js npm cloud ibm-cloud
1个回答
0
投票

感谢ibm开发人员发现了一个不错的解决方案,方法是删除manifest.yml上的npm prune --production &&并将其添加到postintall脚本的package.json中。就我而言,它解决了我的问题。能够成功推送。

© www.soinside.com 2019 - 2024. All rights reserved.