Nodejs cnpm install -g remix-ide 始终无法成功安装,怎么解决?

Nodejs cnpm install -g remix-ide 始终无法成功安装,怎么解决?
λ cnpm install -g remix-ide
Downloading remix-ide to C:\Users\wl\AppData\Roaming\npm\node_modules\remix-ide_tmp
Copying C:\Users\wl\AppData\Roaming\npm\node_modules\remix-ide_tmp<a href="/cdn-cgi/l/email-protection" class=“cf_email” data-cfemail=“520d20373f3b2a7f3b363712627c647c66”>[email protected]@remix-ide to C:\Users\wl\AppD
ata\Roaming\npm\node_modules\remix-ide
Installing remix-ide’s dependencies to C:\Users\wl\AppData\Roaming\npm\node_modules\remix-ide/node_modules
[remixd@git+https://github.com/ethereum/remixd.git] install remixd from git git+https://github.com/ethereum/remixd.git, may be very slow, please keep patience
[1/2] [email protected] installed at node_modules<a href="/cdn-cgi/l/email-protection" class=“cf_email” data-cfemail=“257a4d5151550856405753405765150b1c0b15”>[email protected]@http-server
[email protected] download from binary mirror: {“module_name”:“fse”,“module_path”:"./lib/binding/{configuration}/{node_abi}-{platform}-{arch}/",“remote_path”:"./v{version}/",“package_name”:"{module_name}-v{version}-{node_abi}-{platform}-{arch}.tar.gz",“host”:“https://cdn.npm.taobao.org/dist/fsevents”}
platform unsupported [email protected][email protected] › fsevents@^1.2.2 Package require os(darwin) not compatible with your platform(win32)
[fsevents@^1.2.2] optional install error: Package require os(darwin) not compatible with your platform(win32)
[[email protected][email protected][email protected][email protected][email protected] › websocket@git://github.com/frozeman/WebSocket-Node.git#browserifyCompatible] install websocket from git git://github.com/frozeman/WebSocket-Node.git#browserifyCompatible, may be very slow, please keep patience
scripts.preinstall [email protected][email protected][email protected][email protected][email protected] › scrypt@^6.0.2 “node node-scrypt-preinstall.js”
[2/2] remixd@git+https://github.com/ethereum/remixd.git installed at node_modules<a href="/cdn-cgi/l/email-protection" class=“cf_email” data-cfemail=“540b2631393d2c3014647a657a6c793538243c357a60”>[email protected]@remixd
execute post install 3 scripts…
[1/3] scripts.install [email protected] › websocket@^1.0.24 run “(node-gyp rebuild 2> builderror.log) || (exit 0)“

C:\Users\wl\AppData\Roaming\npm\node_modules\remix-ide\node_modules<a href=”/cdn-cgi/l/email-protection” class=“cf_email” data-cfemail=“7a250d1f18091519111f0e3a4b544a54484c”>[email protected]@websocket>node “C:\Users\wl\AppData\Roaming\npm\node_modules\cnpm\node_modules\npminstall\node-gyp-bin\node-gyp.js” rebuild
[1/3] scripts.install [email protected] › websocket@^1.0.24 finished in 841ms
[2/3] scripts.install [email protected][email protected][email protected][email protected][email protected] › scrypt@^6.0.2 run “node-gyp rebuild"

C:\Users\wl\AppData\Roaming\npm\node_modules\remix-ide\node_modules<a href=”/cdn-cgi/l/email-protection" class=“cf_email” data-cfemail=“4f103c2c3d363f3b0f79617f617c”>[email protected]@scrypt>node “C:\Users\wl\AppData\Roaming\npm\node_modules\cnpm\node_modules\npminstall\node-gyp-bin\node-gyp.js” rebuild
gyp ERR! configure error
gyp ERR! stack Error: Command failed: C:\Python\Python37-32\python.EXE -c import sys; print “%s.%s.%s” % sys.version_info[:3];
gyp ERR! stack File “<string>”, line 1
gyp ERR! stack import sys; print “%s.%s.%s” % sys.version_info[:3];
gyp ERR! stack ^
gyp ERR! stack SyntaxError: invalid syntax
gyp ERR! stack
gyp ERR! stack at ChildProcess.exithandler (child_process.js:288:12)
gyp ERR! stack at ChildProcess.emit (events.js:182:13)
gyp ERR! stack at maybeClose (internal/child_process.js:962:16)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:249:5)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command “D:\Program Files\nodejs\node.exe” “C:\Users\wl\AppData\Roaming\npm\node_modules\cnpm\node_modules\npminstall\node-gyp-bin\node-gyp.js” “rebuild"
gyp ERR! cwd C:\Users\wl\AppData\Roaming\npm\node_modules\remix-ide\node_modules<a href=”/cdn-cgi/l/email-protection" class=“cf_email” data-cfemail=“e7b89484959e9793a7d1c9d7c9d4”>[email protected]@scrypt
gyp ERR! node -v v10.8.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
Install fail! Error: post install error, please remove node_modules before retry!
Run “C:\Windows\system32\cmd.exe /d /s /c node-gyp rebuild” error, exit code 1
Error: post install error, please remove node_modules before retry!
Run “C:\Windows\system32\cmd.exe /d /s /c node-gyp rebuild” error, exit code 1
at ChildProcess.proc.on.code (C:\Users\wl\AppData\Roaming\npm\node_modules\cnpm\node_modules\runscript\index.js:74:21)
at ChildProcess.emit (events.js:182:13)
at maybeClose (internal/child_process.js:962:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:249:5)
npminstall version: 3.11.0
npminstall args: D:\Program Files\nodejs\node.exe C:\Users\wl\AppData\Roaming\npm\node_modules\cnpm\node_modules\npminstall\bin\install.js --fix-bug-versions --china --userconfig=C:\Users\wl.cnpmrc --disturl=https://npm.taobao.org/mirrors/node --registry=https://registry.npm.taobao.org -g remix-ide


2 回复

安装个 python 2 吧


遇到使用 cnpm install -g remix-ide 无法成功安装的问题时,可以尝试以下几个步骤来解决:

  1. 检查网络连接: 确保你的网络连接稳定,并且 cnpm 可以正常访问远程仓库。

  2. 清理 npm 缓存: 有时候缓存中的旧数据可能导致安装失败,可以尝试清理缓存:

    cnpm cache clean --force
    
  3. 尝试使用 npm: 如果 cnpm 仍然无法工作,可以尝试使用原生的 npm 来安装:

    npm install -g remix-ide --registry=https://registry.npmmirror.com
    

    这里使用了 npmmirror 作为镜像源,以确保在国内网络环境下能够稳定下载。

  4. 检查 npm/cnpm 版本: 确保你的 npmcnpm 版本是最新的,或者至少是兼容 remix-ide 的版本。可以通过以下命令更新 cnpm

    npm install -g cnpm --registry=https://registry.npmmirror.com
    
  5. 查看错误日志: 如果以上方法仍然无法解决问题,建议查看安装过程中的错误日志,以获取更具体的错误信息。这可以帮助你更准确地定位问题所在。

  6. 使用 Docker: 如果本地环境始终无法安装,可以考虑使用 Docker 来运行 remix-ide,这样可以避免很多环境相关的问题。

希望这些方法能帮助你成功安装 remix-ide。如果问题依然存在,请提供更详细的错误信息以便进一步分析。

回到顶部