在Windows上安装sqlite3

时间:2019-05-06 19:43:04

标签: node.js electron visual-studio-2017-build-tools

我正在尝试将"electron": "^4.1.4","sqlite3": "^4.0.6"上的windows 8.1node v10.15.3一起使用。

我尝试安装windows-build-tools,例如:

npm install --global --production windows-build-tools@4.0.0

此外,我使用了electron-rebuild -w sqlite3

V Rebuild Complete

该操作成功完成,但是,当尝试安装npm install sqlite3 --save时,我得到了:

62 silly saveTree `-- sqlite3@4.0.6
62 silly saveTree   +-- nan@2.10.0
62 silly saveTree   `-- node-pre-gyp@0.11.0
62 silly saveTree     +-- needle@2.3.0
62 silly saveTree     | `-- debug@4.1.1
62 silly saveTree     +-- nopt@4.0.1
62 silly saveTree     +-- npm-packlist@1.4.1
62 silly saveTree     | +-- ignore-walk@3.0.1
62 silly saveTree     | `-- npm-bundled@1.0.6
62 silly saveTree     `-- tar@4.4.8
62 silly saveTree       +-- chownr@1.1.1
62 silly saveTree       +-- fs-minipass@1.2.5
62 silly saveTree       | `-- minipass@2.3.5
62 silly saveTree       |   `-- yallist@3.0.3
62 silly saveTree       +-- minipass@2.3.5
62 silly saveTree       +-- minizlib@1.2.1
62 silly saveTree       `-- yallist@3.0.3
63 verbose stack Error: EPERM: operation not permitted, unlink 'C:\Users\admin\Desktop\projects\mytestapp\node_modules\.sqlite3.DELETE\lib\binding\electron-v4.1-win32-x64\node_sqlite3.node'
64 verbose cwd C:\Users\admin\Desktop\projects\mytestapp
65 verbose Windows_NT 6.3.9600
66 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\admin\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install"
67 verbose node v10.15.3
68 verbose npm  v6.9.0
69 error path C:\Users\admin\Desktop\projects\mytestapp\node_modules\.sqlite3.DELETE\lib\binding\electron-v4.1-win32-x64\node_sqlite3.node
70 error code EPERM
71 error errno -4048
72 error syscall unlink
73 error Error: EPERM: operation not permitted, unlink 'C:\Users\admin\Desktop\projects\mytestapp\node_modules\.sqlite3.DELETE\lib\binding\electron-v4.1-win32-x64\node_sqlite3.node'
73 error  { [Error: EPERM: operation not permitted, unlink 'C:\Users\admin\Desktop\projects\mytestapp\node_modules\.sqlite3.DELETE\lib\binding\electron-v4.1-win32-x64\node_sqlite3.node']
73 error   cause:
73 error    { Error: EPERM: operation not permitted, unlink 'C:\Users\admin\Desktop\projects\mytestapp\node_modules\.sqlite3.DELETE\lib\binding\electron-v4.1-win32-x64\node_sqlite3.node'
73 error      errno: -4048,
73 error      code: 'EPERM',
73 error      syscall: 'unlink',
73 error      path:
73 error       'C:\\Users\\admin\\Desktop\\projects\\mytestapp\\node_modules\\.sqlite3.DELETE\\lib\\binding\\electron-v4.1-win32-x64\\node_sqlite3.node' },
73 error   stack:
73 error    'Error: EPERM: operation not permitted, unlink \'C:\\Users\\admin\\Desktop\\projects\\mytestapp\\node_modules\\.sqlite3.DELETE\\lib\\binding\\electron-v4.1-win32-x64\\node_sqlite3.node\'',
73 error   errno: -4048,
73 error   code: 'EPERM',
73 error   syscall: 'unlink',
73 error   path:
73 error    'C:\\Users\\admin\\Desktop\\projects\\mytestapp\\node_modules\\.sqlite3.DELETE\\lib\\binding\\electron-v4.1-win32-x64\\node_sqlite3.node',
73 error   parent: 'mytestapp' }
74 error The operation was rejected by your operating system.
74 error It's possible that the file was already in use (by a text editor or antivirus),
74 error or that you lack permissions to access it.
74 error
74 error If you believe this might be a permissions issue, please double-check the
74 error permissions of the file and its containing directories, or try running
74 error the command again as root/Administrator (though this is not recommended).
75 verbose exit [ -4048, true ]

您可以看到我遇到了错误!

有人建议我在做什么错吗?

感谢您的答复!

1 个答案:

答案 0 :(得分:0)

您应该尝试如下操作。对我有帮助

添加到您的package.json

"scripts": {
        "postinstall": "install-app-deps",
 }

运行类似npm run postinstall的命令