npm 模块不会在没有此类文件的情况下执行,但它确实存在 [英] npm module will not execute with no such file, but it does exists

查看:42
本文介绍了npm 模块不会在没有此类文件的情况下执行,但它确实存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

运行 Windows 10 和 git bash.

Running Windows 10 and git bash.

我正在尝试运行 webdriver io npm 模块.它显然存在于我的系统上,但是当我尝试运行它时,它会说没有这样的文件.我对 npm 本身没有任何问题.

I am trying to run the webdriver io npm module. It clearly exists on my system, but when I try to run it it will say no such file. I am not having any issues with npm itself.

任何想法有什么问题?

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 目录内容)无法运行.

You probably were installed this package via another system ( linux maybe ) or WSL ( Windows subsystem for Linux: Bash on windows ); This way npm executables ( /node_modules/.bin directory content ) could not be run.

首先通过WSL卸载包来重新安装:

Reinstalling the package by first uninstall it via WSL:

npm uninstall wdio

然后通过git-bash安装:

npm install wdio

应该可以消除这个问题.如果没有尝试通过 Windows 终端( CMD 或 PowerShell )安装软件包.这样,在 ./node_modules/.bin/ 目录中,您应该会在 wdio 文件旁边看到一个 wdio.cmd 文件,并且您的可执行文件已准备就绪:

should eliminate the problem. If not try to install the package via Windows terminals( CMD or PowerShell ). this way in ./node_modules/.bin/ directory you should see a wdio.cmd file beside wdio file and your executable is ready:

user@AUS-LT-384 MINGW64 ~/github/e2e-temp (master)
$ ./node_modules/.bin/wdio -v
v4.12.0

这篇关于npm 模块不会在没有此类文件的情况下执行,但它确实存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆