Cordova Apache错误的模块路径 [英] Cordova Apache wrong module path
问题描述
我的问题
我正在学习使用cordova apache(以前是Phonegap?)的混合应用程序我按照他们推荐我们的网站的步骤:
https://cordova.apache.org/docs/en/latest/guide/cli/index.html
我成功安装了nodeJS(如果我执行命令节点--version,它会返回其版本)
但是当我尝试安装cordova,一切似乎工作,但不是CLI。
所以:我想CLI配置不正确,但我不知道。任何人都可以帮助我?
注意:
-
用于安装cordova(全球)的命令:
npm install -g cordova
-
命令用于检查是否已正确安装并可从命令行访问
cordova --version
module.js:340
throw err;
^
错误:无法在Function.Module中找到模块'c:\Program Files\\\
odejs\\\
ode_modules\cordova\bin \cordova'
。 _resolveFilename(module.js:338:15)
在Function.Module._load(module.js:289:25)
在Function.Module.runMain(module.js:457:10)
at startup(node.js:138:18)
at node.js:974:3
-
我发现错误中的路径不存在:
c:\Program Files \\\
odejs\\\
ode_modules\cordova\bin\cordova
-
正确的路径必须是:
C:\Users\Username\AppData\Roaming\\\
pm\\\
ode_modules\ cordova \bin\cordova
-
我在全球系统环境中配置了此路径: / p>
C:\Users\Username\AppData\Roaming\\\
pm
-
我注意到这个文件(需要从CLI调用)
#!/ bin / sh
basedir =`dirname'$ 0`
case`uname` in
* CYGWIN *) basedir =`cygpath -w$ basedir`;;
esac
if [-x$ basedir / node];那么
$ basedir / node$ basedir / node_modules / cordova / bin / cordova$ @
ret = $?
else
节点$ basedir / node_modules / cordova / bin / cordova$ @
ret = $?
fi
exit $ ret
-
npm -g install npm
npm install -g cordova
问题是捆绑的npm版本最新的稳定版本的节点不支持一些软件包。
My question
I am learning to make a hybrid application with cordova apache (previously Phonegap?) I am following the steps they recommend our their website:
https://cordova.apache.org/docs/en/latest/guide/cli/index.html
I successfully installed nodeJS (if I do the command node --version, it will return its version)
But when I try to install cordova, everything seems working, but not the CLI.
So: I guess the CLI is configured incorrect, but I am not sure. Anyone can help me here?
Notes:
Command used to install cordova (globally):
npm install -g cordova
Command used to check if it was installed correctly and accessible from the command line (with given errors):
cordova --version module.js:340 throw err; ^ Error: Cannot find module 'c:\Program Files\nodejs\node_modules\cordova\bin\cordova' at Function.Module._resolveFilename (module.js:338:15) at Function.Module._load (module.js:289:25) at Function.Module.runMain (module.js:457:10) at startup (node.js:138:18) at node.js:974:3
I found out the path in the error doesn't exist:
c:\Program Files\nodejs\node_modules\cordova\bin\cordova
The correct path have to be:
C:\Users\Username\AppData\Roaming\npm\node_modules\cordova\bin\cordova
I configured this path in my global system environments:
C:\Users\Username\AppData\Roaming\npm
I noticed this file (which needs to be called from CLI I guess)
#!/bin/sh basedir=`dirname "$0"` case `uname` in *CYGWIN*) basedir=`cygpath -w "$basedir"`;; esac if [ -x "$basedir/node" ]; then "$basedir/node" "$basedir/node_modules/cordova/bin/cordova" "$@" ret=$? else node "$basedir/node_modules/cordova/bin/cordova" "$@" ret=$? fi exit $ret
I am working on Windows 8
I faced the same issue recently. Solved it by doing the following:
npm -g install npm
npm install -g cordova
The issue was that the version of npm that is bundled with the latest stable version of node does not support some packages.
这篇关于Cordova Apache错误的模块路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!