执行npm安装模块的命令 Cannot find module
2016-12-28 15:09
435 查看
npm 安装了 appium 和 appium-doctor 运行命令,appium-doctor 提示找不到模块:
C:\Users\autotest>appium
module.js:471
throw err;
^
Error: Cannot find module 'C:\Windows\System32\node_modules\appium\bin\appium.js
'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:394:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:509:3
C:\Users\autotest>
appium 是通过-g 全局安装的,安装的目录为:C:\Users\autotest\AppData\Roaming\npm
执行命令获取:
C:\Users\autotest>npm config get prefix
C:\Users\autotest\AppData\Roaming\npm
设置环境变量都不起作用,重新安装nodejs 、npm 安装appium-doctor 再运行都不行。磁盘搜索"appium" 关键字,发现"C:\Windows\System32"下面有appium 和appium-doctor 文件。原来执行的都是这个地方的命令,而这个目录下面的node_modules 文件夹早就被删除了。所以出现这个提示:
回想事情发生的原因,原来是通过管理员运行cmd ,默认进入的目录是:C:\Windows\System32 。有次执行安装appium 没有使用参数-g 导致就直接在这个目录下面安装了appium 和appium-doctor ,生成了appium、appium-doctor文件 和一个目录C:\Windows\System32\node_modules。只删除了 目录C:\Windows\System32\node_modules,而没有删除C:\Windows\System32 下面的相关文件。
总结:以后遇到类似找不到模块,解决问题方法:直接进入提示的路径的node_nodules 上一层目录,如提示:C:\Windows\System32\node_modules\appium\bin\appium.js 进入目录C:\Windows\System32,删除输入的命令即可
C:\Users\autotest>appium
module.js:471
throw err;
^
Error: Cannot find module 'C:\Windows\System32\node_modules\appium\bin\appium.js
'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:394:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:509:3
C:\Users\autotest>
appium 是通过-g 全局安装的,安装的目录为:C:\Users\autotest\AppData\Roaming\npm
执行命令获取:
C:\Users\autotest>npm config get prefix
C:\Users\autotest\AppData\Roaming\npm
设置环境变量都不起作用,重新安装nodejs 、npm 安装appium-doctor 再运行都不行。磁盘搜索"appium" 关键字,发现"C:\Windows\System32"下面有appium 和appium-doctor 文件。原来执行的都是这个地方的命令,而这个目录下面的node_modules 文件夹早就被删除了。所以出现这个提示:
回想事情发生的原因,原来是通过管理员运行cmd ,默认进入的目录是:C:\Windows\System32 。有次执行安装appium 没有使用参数-g 导致就直接在这个目录下面安装了appium 和appium-doctor ,生成了appium、appium-doctor文件 和一个目录C:\Windows\System32\node_modules。只删除了 目录C:\Windows\System32\node_modules,而没有删除C:\Windows\System32 下面的相关文件。
总结:以后遇到类似找不到模块,解决问题方法:直接进入提示的路径的node_nodules 上一层目录,如提示:C:\Windows\System32\node_modules\appium\bin\appium.js 进入目录C:\Windows\System32,删除输入的命令即可
相关文章推荐
- macOS 下 npm 全局安装仍然提示 Cannot find module 'xxx' 的解决方案
- Windows node.js npm install express -g Cannot find module 'express'
- Windows node.js npm install express -g Cannot find module 'express'
- 关于node下载的模块无法使用(Cannot find module)解决方法
- NPM- Cannot find module 'xxxxx'
- Nodejs Error: Cannot find module 当前文件夹下的模块
- Windows安装Nodejs的模块和引用问题(cannot find moudel "xxx")?
- opencv2.3.0安装时出现error MSB3073: 命令“setlocal“ 和file INSTALL cannot find opencv_ffmpeg230...
- 安装phoenix时,执行命令./sqlline.py hostname1,hostname2.hostname3..... 时报错 ImportError: No module named argparse
- 在Linux下安装nodejs遇到Cannot find module 'npmlog'问题的解决方法
- phpize命令在安装AMQP插件是报错phpize:Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF envir的解决方法
- npm 命令安装模块
- npm使用过程中遇到的 Cannot find module 'internal/fs' 的问题
- 一条命令解决500 Error: Cannot find module 'XXX'
- node开发:windows环境下npm Cannot find module 'semver'
- 安装express之后,会出现500 Error: Cannot find module 'jade'错误
- Cordova安装Cannot find module 'bplist-parser'的错误
- Error: Cannot find module 'npm-autoinit/autoinit'
- npm global module error---cannot find module
- npm Cannot find module 'semver' --解决方案