繁体   English   中英

如何在NodeJS中手动安装全局模块

[英]How to manually install a global module in NodeJS

由于某种原因,我试图在计算机上手动安装串行端口模块。 我尝试复制github文件,然后将其粘贴到漫游文件夹中,但是随后遇到以下问题。

└─┬ serialport@4.0.1
  ├── UNMET DEPENDENCY bindings@1.2.1
  ├── UNMET DEPENDENCY commander@^2.9.0
  ├── UNMET DEPENDENCY debug@^2.1.1
  ├── UNMET DEPENDENCY lie@^3.1.0
  ├── UNMET DEPENDENCY nan@^2.3.5
  ├── UNMET DEPENDENCY node-pre-gyp@^0.6.26
  └── UNMET DEPENDENCY object.assign@^4.0.3

npm ERR! missing: bindings@1.2.1, required by serialport@4.0.1
npm ERR! missing: commander@^2.9.0, required by serialport@4.0.1
npm ERR! missing: debug@^2.1.1, required by serialport@4.0.1
npm ERR! missing: lie@^3.1.0, required by serialport@4.0.1
npm ERR! missing: nan@^2.3.5, required by serialport@4.0.1
npm ERR! missing: node-pre-gyp@^0.6.26, required by serialport@4.0.1
npm ERR! missing: object.assign@^4.0.3, required by serialport@4.0.1

我正在尝试从Windows命令提示符下运行serialport-list 原因是串口。

当我尝试以普通方式串行端口时,遇到以下错误:

vcbuild.exe : error VCBLD0010: Project 'C:\Users\Jonathan\AppData\Roaming\npm\node_modules\serialport\build\serialport.
vcproj' requires upgrade. Use 'vcbuild /upgrade' or 'devenv /upgrade' to upgrade the project. [C:\Users\Jonathan\AppDat
a\Roaming\npm\node_modules\serialport\build\binding.sln]

我无法应用升级,因为该文件不存在,因此我手动下载了serialport.vcproj文件并应用了升级,然后复制了serialport节点模块,但仍无法在命令提示符下运行serialport-list

更新

C:\Users\Jonathan\AppData\Roaming\npm\node_modules\serialport>vcbuild /upgrade C:\Users\Jonathan\AppData\Roaming\npm\node_modules\serialport\build\serialport.vcproj
Microsoft (R) Visual C++ Project Builder - Command Line Version 9.00.30729
Copyright (C) Microsoft Corporation. All rights reserved.

Successfully upgraded project file 'C:\Users\Jonathan\AppData\Roaming\npm\node_modules\serialport\build\serialport.vcproj'.
C:\Users\Jonathan\AppData\Roaming\npm\node_modules\serialport>npm install

> serialport@4.0.1 install C:\Users\Jonathan\AppData\Roaming\npm\node_modules\serialport
> node-pre-gyp install --fallback-to-build

node-pre-gyp ERR! Tried to download: https://github.com/EmergingTechnologyAdvisors/node-serialport/releases/download/4.0.1/serialport-v4.0.1-node-v44-win32-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for serialport@4.0.1 and node@2.2.1 (node-v44 ABI) (falling back to source compile with node-gyp)

C:\Users\Jonathan\AppData\Roaming\npm\node_modules\serialport>if not defined npm_config_node_gyp (node "C:\Program Files\iojs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" clean )  else (node  clean )
gyp ERR! clean error
gyp ERR! stack Error: EBUSY: resource busy or locked, rmdir 'C:\Users\Jonathan\AppData\Roaming\npm\node_modules\serialport\build'
gyp ERR! stack     at Error (native)
gyp ERR! System Windows_NT 6.3.9600
gyp ERR! command "C:\\Program Files\\iojs\\node.exe" "C:\\Program Files\\iojs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "clean"
gyp ERR! cwd C:\Users\Jonathan\AppData\Roaming\npm\node_modules\serialport
gyp ERR! node -v v2.2.1
gyp ERR! node-gyp -v v1.0.3
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute 'node-gyp.cmd clean' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (C:\Users\Jonathan\AppData\Roaming\npm\node_modules\serialport\node_modules\node-pre-gyp\lib\util\compile.js:83:29)
node-pre-gyp ERR! stack     at emitTwo (events.js:87:13)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:763:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:210:5)
node-pre-gyp ERR! System Windows_NT 6.3.9600
node-pre-gyp ERR! command "C:\\Program Files\\iojs\\node.exe" "C:\\Users\\Jonathan\\AppData\\Roaming\\npm\\node_modules\\serialport\\node_modules\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd C:\Users\Jonathan\AppData\Roaming\npm\node_modules\serialport
node-pre-gyp ERR! node -v v2.2.1
node-pre-gyp ERR! node-pre-gyp -v v0.6.29
node-pre-gyp ERR! not ok
Failed to execute 'node-gyp.cmd clean' (1)

npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files\\iojs\\node.exe" "C:\\Program Files\\iojs\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! node v2.2.1
npm ERR! npm  v2.11.0
npm ERR! code ELIFECYCLE
npm ERR! serialport@4.0.1 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the serialport@4.0.1 install script 'node-pre-gyp install --fallback-to-build'.
npm ERR! This is most likely a problem with the serialport package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-pre-gyp install --fallback-to-build
npm ERR! You can get their info via:
npm ERR!     npm owner ls serialport
npm ERR! There is likely additional logging output above.

如果克隆了github存储库,则应进入克隆的文件夹并运行npm install来安装serialport的依赖项。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM