Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
104 views
in Technique[技术] by (71.8m points)

node.js - SQLite issue when installing dependencies on VPS

I'm trying to host a discord bot developed in TypeScript into a VPS I own from galaxygate which turns with Ubuntu 20.04.

Git was already installed, so I cloned and pulled my project hosted on GitHub. And then I tried to npm install my dependencies.

Here are the dependencies from the package.json:

{
  "devDependencies": {
    "@types/node": "^14.14.22",
    "@types/ws": "^7.4.0",
    "rimraf": "^3.0.2",
    "ts-node-dev": "^1.1.1",
    "tsconfig-paths": "^3.9.0",
    "typescript": "^4.1.3"
  },
  "dependencies": {
    "consola": "^2.15.0",
    "discord-akairo": "^8.1.0",
    "discord.js": "github:discordjs/discord.js",
    "dotenv": "^8.2.0",
    "sqlite3": "^5.0.1",
    "ts-node": "^9.1.1",
    "typeorm": "^0.2.30"
  }
}

When I install dependencies I had some errors, so via nvm I set the node version to a good one for sqlite3 :

  • node -v => v14.15.4
  • npm -v => 6.14.10

Here is the trace of npm i:

> [email protected] install /root/Main/Perceval/node_modules/sqlite3
> node-pre-gyp install --fallback-to-build

node-pre-gyp WARN Using request for node-pre-gyp https download
node-pre-gyp WARN Tried to download(403): https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v5.0.1/napi-v6-linux-x64.tar.gz
node-pre-gyp WARN Pre-built binaries not found for [email protected] and [email protected] (node-v83 ABI, glibc) (falling back to source compile with node-gyp)
make: Entering directory '/root/Main/Perceval/node_modules/sqlite3/build'
  CC(target) Release/obj.target/nothing/../node-addon-api/nothing.o
make: cc: Command not found
make: *** [../node-addon-api/nothing.target.mk:107: Release/obj.target/nothing/../node-addon-api/nothing.o] Error 127
make: Leaving directory '/root/Main/Perceval/node_modules/sqlite3/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/root/Main/Perceval/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:315:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
gyp ERR! System Linux 5.4.0-42-generic
gyp ERR! command "/root/.nvm/versions/node/v14.15.4/bin/node" "/root/Main/Perceval/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/root/Main/Perceval/node_modules/sqlite3/lib/binding/napi-v6-linux-x64/node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=/root/Main/Perceval/node_modules/sqlite3/lib/binding/napi-v6-linux-x64" "--napi_version=7" "--node_abi_napi=napi" "--napi_build_version=6" "--node_napi_label=napi-v6"
gyp ERR! cwd /root/Main/Perceval/node_modules/sqlite3
gyp ERR! node -v v14.15.4
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/root/.nvm/versions/node/v14.15.4/bin/node /root/Main/Perceval/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/root/Main/Perceval/node_modules/sqlite3/lib/binding/napi-v6-linux-x64/node_sqlite3.node --module_name=node_sqlite3 --module_path=/root/Main/Perceval/node_modules/sqlite3/lib/binding/napi-v6-linux-x64 --napi_version=7 --node_abi_napi=napi --napi_build_version=6 --node_napi_label=napi-v6' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/root/Main/Perceval/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:315:20)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:1048:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
node-pre-gyp ERR! System Linux 5.4.0-42-generic
node-pre-gyp ERR! command "/root/.nvm/versions/node/v14.15.4/bin/node" "/root/Main/Perceval/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /root/Main/Perceval/node_modules/sqlite3
node-pre-gyp ERR! node -v v14.15.4
node-pre-gyp ERR! node-pre-gyp -v v0.11.0
node-pre-gyp ERR! not ok
Failed to execute '/root/.nvm/versions/node/v14.15.4/bin/node /root/Main/Perceval/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/root/Main/Perceval/node_modules/sqlite3/lib/binding/napi-v6-linux-x64/node_sqlite3.node --module_name=node_sqlite3 --module_path=/root/Main/Perceval/node_modules/sqlite3/lib/binding/napi-v6-linux-x64 --napi_version=7 --node_abi_napi=napi --napi_build_version=6 --node_napi_label=napi-v6' (1)
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2021-02-05T15_36_09_631Z-debug.log

And here for nmp i -D sqlite3:

npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated [email protected]: this library is no longer supported

> [email protected] install /root/Main/Perceval/node_modules/sqlite3
> node-pre-gyp install --fallback-to-build

node-pre-gyp WARN Using request for node-pre-gyp https download
node-pre-gyp WARN Tried to download(403): https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v5.0.1/napi-v6-linux-x64.tar.gz
node-pre-gyp WARN Pre-built binaries not found for [email protected] and [email protected] (node-v83 ABI, glibc) (falling back to source compile with node-gyp)
make: Entering directory '/root/Main/Perceval/node_modules/sqlite3/build'
  CC(target) Release/obj.target/nothing/../node-addon-api/nothing.o
make: cc: Command not found
make: *** [../node-addon-api/nothing.target.mk:107: Release/obj.target/nothing/../node-addon-api/nothing.o] Error 127
make: Leaving directory '/root/Main/Perceval/node_modules/sqlite3/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/root/Main/Perceval/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:315:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
gyp ERR! System Linux 5.4.0-42-generic
gyp ERR! command "/root/.nvm/versions/node/v14.15.4/bin/node" "/root/Main/Perceval/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/root/Main/Perceval/node_modules/sqlite3/lib/binding/napi-v6-linux-x64/node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=/root/Main/Perceval/node_modules/sqlite3/lib/binding/napi-v6-linux-x64" "--napi_version=7" "--node_abi_napi=napi" "--napi_build_version=6" "--node_napi_label=napi-v6"
gyp ERR! cwd /root/Main/Perceval/node_modules/sqlite3
gyp ERR! node -v v14.15.4
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/root/.nvm/versions/node/v14.15.4/bin/node /root/Main/Perceval/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/root/Main/Perceval/node_modules/sqlite3/lib/binding/napi-v6-linux-x64/node_sqlite3.node --module_name=node_sqlite3 --module_path=/root/Main/Perceval/node_modules/sqlite3/lib/binding/napi-v6-linux-x64 --napi_version=7 --node_abi_napi=napi --napi_build_version=6 --node_napi_label=napi-v6' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/root/Main/Perceval/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:315:20)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:1048:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
node-pre-gyp ERR! System Linux 5.4.0-42-generic
node-pre-gyp ERR! command "/root/.nvm/versions/node/v14.15.4/bin/node" "/root/Main/Perceval/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /root/Main/Perceval/node_modules/sqlite3
node-pre-gyp ERR! node -v v14.15.4
node-pre-gyp ERR! node-pre-gyp -v v0.11.0
node-pre-gyp ERR! not ok
Failed to execute '/root/.nvm/versions/node/v14.15.4/bin/node /root/Main/Perceval/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/root/Main/Perceval/node_modules/sqlite3/lib/binding/napi-v6-linux-x64/node_sqlite3.node --module_name=node_sqlite3 --module_path=/root/Main/Perceval/node_modules/sqlite3/lib/binding/napi-v6-linux-x64 --napi_version=7 --node_abi_napi=napi --napi_build_version=6 --node_napi_label=napi-v6' (1)
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2021-02-05T15_37_32_352Z-debug.log
question from:https://stackoverflow.com/questions/66066056/sqlite-issue-when-installing-dependencies-on-vps

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The error is not in python, it is in the sqlite3 package itself.

Reverting back to v5.0.0 will resolve this

npm install [email protected]

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...