pashpashpash / vault-ai

OP Vault ChatGPT: Give ChatGPT long-term memory using the OP Stack (OpenAI + Pinecone Vector Database). Upload your own custom knowledge base files (PDF, txt, epub, etc) using a simple React frontend.
https://vault.pash.city
MIT License
3.25k stars 306 forks source link

npm install Error "sh: 1: source: not found" #39

Open ms6rb opened 1 year ago

ms6rb commented 1 year ago

I'm trying to install the packages on fresh WSL Ubuntu

$ uname -a
Linux Ms6RB 5.15.90.1-microsoft-standard-WSL2 #1 SMP Fri Jan 27 02:56:13 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

$ npm -v
9.6.5

node -v
v19.0.0

$ go version
go version go1.20.3 linux/amd64

when I try npm install:

> vault-web-server@1.0.0 postinstall
> source ./scripts/source-me.sh && ./scripts/go-compile.sh ./vault-web-server

sh: 1: source: not found
npm ERR! code 127
npm ERR! path /home/ms6rb/vault-ai
npm ERR! command failed
npm ERR! command sh -c source ./scripts/source-me.sh && ./scripts/go-compile.sh ./vault-web-server

npm ERR! A complete log of this run can be found in: /home/ms6rb/.npm/_logs/2023-04-22T10_52_12_207Z-debug-0.log

Log:

110 timing auditReport:init Completed in 105ms
111 timing reify:audit Completed in 671ms
112 timing reify Completed in 1344ms
113 timing command:install Completed in 1411ms
114 verbose stack Error: command failed
114 verbose stack     at ChildProcess.<anonymous> (/home/ms6rb/.nvm/versions/node/v19.0.0/lib/node_modules/dules/npm/node_modules/@npmcli/promise-spawn/lib/index.js:53:27)
114 verbose stack     at ChildProcess.emit (node:events:513:28)
114 verbose stack     at maybeClose (node:internal/child_process:1098:16)
114 verbose stack     at ChildProcess._handle.onexit (node:internal/child_process:304:5)
115 verbose pkgid vault-web-server@1.0.0
116 verbose cwd /home/ms6rb/vault-ai
117 verbose Linux 5.15.90.1-microsoft-standard-WSL2
118 verbose node v19.0.0
119 verbose npm  v9.6.5
120 error code 127
121 error path /home/ms6rb/vault-ai
122 error command failed
123 error command sh -c source ./scripts/source-me.sh && ./scripts/go-compile.sh ./vault-web-server
124 verbose exit 127
125 timing npm Completed in 1560ms
126 verbose code 127
127 error A complete log of this run can be found in: /home/ms6rb/.npm/_logs/2023-04-22T10_52_12_207Z-debug-debug-0.log
marcocarrero commented 1 year ago

Same Issue, i tried on windows, and ubuntu, no working

tjb4578 commented 1 year ago

Try changing the npm scripts in package.json according to the following comment:

https://github.com/pashpashpash/vault-ai/issues/7#issuecomment-1513550604

ms6rb commented 1 year ago

Try changing the npm scripts in package.json according to the following comment:

#7 (comment)

it worked regarding the installation of the packages. but when I try npm start nothing happened and I got this:

npm start

> vault-web-server@1.0.0 start
> bash -c 'source ./scripts/source-me.sh  && ./scripts/go-compile.sh ./vault-web-server'

=> Environment Variables Loaded
-> Installing './vault-web-server' dependencies
->  Compiling './vault-web-server'
   ... done

although npm run dev work fine.

pashpashpash commented 1 year ago

@ms6rb Those logs look good – the only difference is you want to run ./bin/vault-web-server after it compiles to start the server, and then go to your browser on http://localhost:8100/ to use the site locally

pashpashpash commented 1 year ago

@ms6rb try swapping out the top part of your source script to this:

#!/bin/bash
# Useful variables. Source from the root of the project

# Get the sourced script's directory in a more portable way
if [[ "${BASH_SOURCE[0]}" != /* ]]; then
  script_name="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/$(basename "${BASH_SOURCE[0]}")"
else
  script_name="${BASH_SOURCE[0]}"
fi
dir_path="$( cd "$(dirname "$script_name")" >/dev/null 2>&1 ; pwd -P )"

echo "DEBUG: dir_path = ${dir_path}"
secrets_path="${dir_path}/../secret"
echo "DEBUG: secrets_path = ${secrets_path}"
test ! -d $secrets_path && echo "ERR: ../secret dir missing!" && return 1

And then change your package.json "start" script like so:

 "start": "bash -c '. ./scripts/source-me.sh && ./scripts/go-compile.sh ./vault-web-server && echo && ./bin/vault-web-server'",

then try running npm start

ms6rb commented 1 year ago

I got this error:

> vault-web-server@1.0.0 start
> bash -c '. ./scripts/source-me.sh && ./scripts/go-compile.sh ./vault-web-server && echo && ./bin/vault-web-server'

DEBUG: dir_path = /home/xxx/vault-ai/scripts
DEBUG: secrets_path = /home/xxx/vault-ai/scripts/../secret