nodejs-buildpack icon indicating copy to clipboard operation
nodejs-buildpack copied to clipboard

Failed to start a nodejs app: sh: 1: node_modules/.bin/vite: not found

Open Vector6662 opened this issue 4 months ago • 1 comments

What version of Cloud Foundry and CF CLI are you using? (i.e. What is the output of running cf curl /v2/info && cf version?

cf curl /v2/info && cf version                                                                                  
{"name":"cf-deployment",
"build":"v43.6.0","support":"","version":43,
"description":"SAP BTP Cloud Foundry environment",
"authorization_endpoint":"https://login.cf.sap.hana.ondemand.com",
"token_endpoint":"https://uaa.cf.sap.hana.ondemand.com","min_cli_version":"8.0.0",
"min_recommended_cli_version":null,"app_ssh_endpoint":"ssh.cf.sap.hana.ondemand.com:2222","app_ssh_host_key_fingerprint":"SYWfpJUXGL2T+b8bkK15zppx/fZ08Wc9/iV8bxMLqWI",
"app_ssh_oauth_client":"ssh-proxy","doppler_logging_endpoint":"wss://doppler.cf.sap.hana.ondemand.com:443","api_version":"2.243.0","osbapi_version":"2.15","user":"b0db37ba-f595-4800-bb6c-67e15362d969"}

What version of the buildpack you are using?

nodejs_buildpack-cached-cflinuxfs4-v1.8.29.zip

If you were attempting to accomplish a task, what was it you were attempting to do?

I need to run npm run start to run my app, which will execute command vite - a npm dependency already installed in directory node_modules/.bin/vite. here is the location of vite, and package.json file: image

package.json:

{
  "name": "mmt-ui-app-iflow-transport",
  "version": "0.0.0",
  "private": true,
  "type": "module",
  "scripts": {
    "dev": "vite",
    "start": "node_modules/.bin/vite",
    "build": "run-p type-check \"build-only {@}\" --",
    "preview": "vite preview",
    "build-only": "vite build",
    "type-check": "vue-tsc --build --force",
    "lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
    "format": "prettier --write src/"
  },
  "dependencies": {
    "axios": "^1.7.3",
    "loadash": "^1.0.0",
    "pinia": "^2.1.7",
    "vue": "^3.4.29",
    "vue-router": "^4.3.3"
  },
  "devDependencies": {
    "@rushstack/eslint-patch": "^1.8.0",
    "@tsconfig/node20": "^20.1.4",
    "@types/node": "^20.14.5",
    "@vicons/fluent": "^0.12.0",
    "@vicons/ionicons4": "^0.12.0",
    "@vicons/material": "^0.12.0",
    "@vitejs/plugin-vue": "^5.0.5",
    "@vitejs/plugin-vue-jsx": "^4.0.0",
    "@vue/eslint-config-prettier": "^9.0.0",
    "@vue/eslint-config-typescript": "^13.0.0",
    "@vue/tsconfig": "^0.5.1",
    "eslint": "^8.57.0",
    "eslint-plugin-vue": "^9.23.0",
    "naive-ui": "^2.38.2",
    "npm-run-all2": "^6.2.0",
    "prettier": "^3.2.5",
    "typescript": "~5.4.0",
    "vite": "^5.3.1",
    "vue-tsc": "^2.0.21"
  },
  "engines": {
    "node": "^18.20.4",
    "npm": "^9.8.1"
  }
}

manifest.yaml:

applications:
- name: stage-devops-ui-app-iflow-transport-test-deploy
  command: ls ./node_modules/.bin; npm run start
  buildpacks:
    - nodejs_buildpack
  

In manifest.yaml I use ls ./node_modules/.bin to check if vite already in this directory.

I then run cf push with vendoring app dependencies(include dir node_modules). However this is the output: image So weired. Why it contains only a little part of it should does?

The result of the command I runs locally: image

BTW, I also tried to start app with command npm run dev(i.e. directly runs command vite), alse failed to start app, which means vite didn't in any environment variables either.

What did you expect to happen?

vite should be in node_modules/.bin, because I uploaded it. but may it disappeared? So strange.

What was the actual behavior?

desctiped above

Can you provide a sample app?

Please confirm where necessary:

  • [ x ] I have included a log output
  • [ x ] My log includes an error message
  • [ x ] I have included steps for reproduction

Vector6662 avatar Oct 12 '24 11:10 Vector6662