运行 Windows 10 和 git bash。
我正在尝试运行 webdriver io npm 模块。它显然存在于我的系统上,但是当我尝试运行它时,它会说没有这样的文件。我对 npm 本身没有任何问题。
有什么想法是错的吗?
usery@AUS-LT-384 MINGW64 ~/github/e2e-temp (master)
$ lr ./node_modules/.bin/wdio
-rw-r--r-- 1 user 1049089 23 Mar 27 09:15 ./node_modules/.bin/wdio
user@AUS-LT-384 MINGW64 ~/github/e2e-temp (master)
$ ./node_modules/.bin/wdio wdio.conf.js
./node_modules/.bin/wdio: line 1: ../webdriverio/bin/wdio: No such file or directory
user@AUS-LT-384 MINGW64 ~/github/e2e-temp (master)
$ npm -v
5.6.0
最佳答案
您可能是通过另一个系统(可能是 Linux)或 WSL(Linux 的 Windows 子系统:Windows 上的 Bash)安装了此软件包;这样 npm 可执行文件( /node_modules/.bin
目录内容)就无法运行。
首先通过 WSL
卸载该软件包来重新安装该软件包:
npm uninstall wdio
然后通过git-bash
安装:
npm install wdio
应该可以解决这个问题。如果没有,请尝试通过Windows 终端(CMD 或 PowerShell)安装该软件包。这样,在 ./node_modules/.bin/
目录中,您应该会在 wdio
文件旁边看到一个 wdio.cmd
文件,并且您的可执行文件已准备就绪:
user@AUS-LT-384 MINGW64 ~/github/e2e-temp (master)
$ ./node_modules/.bin/wdio -v
v4.12.0
关于node.js - 如果没有这样的文件,npm 模块将不会执行,但它确实存在,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49515653/