我通过离子运行程序时遇到问题。 我安装了所需的一切,并试图模拟一个Android测试应用程序,它没有任何问题 但如果我尝试启动同事的计划:
npm ERR! Windows_NT 10.0.15063
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "ionic:build" "--"
npm ERR! node v7.10.0
npm ERR! npm v4.2.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1
发生了这些错误,我们对这意味着什么感到困惑。 他在Linux机器上开发了这个应用程序,如果他在他的机器上启动应用程序,它就可以运行。 我正在使用Windows机器。这可能是什么,这是我们的问题的原因吗? 我们都有相同的节点/ npm版本。 我使用“ionic run android”命令来启动应用程序。
顺便说一下。完整的错误日志,如果有帮助:
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'ionic:build',
1 verbose cli '--' ]
2 info using npm@4.2.0
3 info using node@v7.10.0
4 verbose run-script [ 'preionic:build', 'ionic:build', 'postionic:build' ]
5 info lifecycle hnwApp@~preionic:build: hnwApp@
6 silly lifecycle hnwApp@~preionic:build: no script for preionic:build, continuing
7 info lifecycle hnwApp@~ionic:build: hnwApp@
8 verbose lifecycle hnwApp@~ionic:build: unsafe-perm in lifecycle true
9 verbose lifecycle hnwApp@~ionic:build: PATH: C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin;C:\dev\papp\app\node_modules\.bin;C:\Users\entwickler\AppData\Roaming\npm;C:\Program Files\nodejs\;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Lenovo\Touch Fingerprint Software\;C:\Program Files (x86)\Common Files\Lenovo;C:\ProgramData\Lenovo\ReadyApps;C:\Program Files\OpenVPN\bin;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;%JAVA_HOME%\bin;C:\Program Files\apache-ant-1.10.1\bin;%ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools;C:\Program Files\Git\cmd;C:\Gradle\gradle-3.5\bin;C:\Program Files\nodejs\;C:\Users\entwickler\AppData\Local\Microsoft\WindowsApps;C:\Users\entwickler\AppData\Roaming\npm
10 verbose lifecycle hnwApp@~ionic:build: CWD: C:\dev\papp\app
11 silly lifecycle hnwApp@~ionic:build: Args: [ '/d /s /c', 'ionic-app-scripts build' ]
12 silly lifecycle hnwApp@~ionic:build: Returned: code: 1 signal: null
13 info lifecycle hnwApp@~ionic:build: Failed to exec ionic:build script
14 verbose stack Error: hnwApp@ ionic:build: `ionic-app-scripts build`
14 verbose stack Exit status 1
14 verbose stack at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:279:16)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at EventEmitter.emit (events.js:194:7)
14 verbose stack at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:40:14)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at ChildProcess.emit (events.js:194:7)
14 verbose stack at maybeClose (internal/child_process.js:899:16)
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
15 verbose pkgid hnwApp@
16 verbose cwd C:\dev\papp\app
17 error Windows_NT 10.0.15063
18 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "ionic:build" "--"
19 error node v7.10.0
20 error npm v4.2.0
21 error code ELIFECYCLE
22 error errno 1
23 error hnwApp@ ionic:build: `ionic-app-scripts build`
23 error Exit status 1
24 error Failed at the hnwApp@ ionic:build script 'ionic-app-scripts build'.
24 error Make sure you have the latest version of node.js and npm installed.
24 error If you do, this is most likely a problem with the hnwApp package,
24 error not with npm itself.
24 error Tell the author that this fails on your system:
24 error ionic-app-scripts build
24 error You can get information on how to open an issue for this project with:
24 error npm bugs hnwApp
24 error Or if that isn't available, you can get their info via:
24 error npm owner ls hnwApp
24 error There is likely additional logging output above.
25 verbose exit [ 1, true ]
和cmd错误信息:
[08:21:12] ionic-app-scripts 0.0.47
[08:21:12] build dev started ...
[08:21:12] clean started ...
[08:21:12] clean finished in 16 ms
[08:21:12] copy started ...
[08:21:12] transpile started ...
[08:21:17] typescript: C:/dev/papp/app/src/providers/my-data.ts, line: 7
[08:21:17] typescript: C:/dev/papp/app/src/providers/my-data.ts, line: 8
Cannot find name 'require'.
L6: //PouchDB.plugin(require('pouchdb-authentication'));
L7: var PouchDB = require("pouchdb");
L8: PouchDB.plugin(require('pouchdb-authentication'));
Cannot find name 'require'.
L7: var PouchDB = require("pouchdb");
L8: PouchDB.plugin(require('pouchdb-authentication'));
[08:21:17] transpile failed
[08:21:17] ionic-app-script task: "build"
[08:21:17] TypeError: error.message.indexOf is not a function
npm ERR! Windows_NT 10.0.15063
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "ionic:build" "--"
npm ERR! node v7.10.0
npm ERR! npm v4.2.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! hnwApp@ ionic:build: `ionic-app-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the hnwApp@ ionic:build script 'ionic-app-scripts build'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the hnwApp package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! ionic-app-scripts build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs hnwApp
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls hnwApp
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\entwickler\AppData\Roaming\npm-cache\_logs\2017-05-16T06_21_17_597Z-debug.log
非常感谢你。
答案 0 :(得分:0)
问题在于&#34; page-name.component.ts&#34;使用&#34;离子生成页面时创建的文件&#34;命令。
手动创建页面并再次运行它(离子运行android --prod)或(离子运行android --prod)。
试试这个。
答案 1 :(得分:0)
好的,对不起,我是个傻瓜。 实施后
declare var require: any;
在my-data.ts中,该应用终于有效了。 浪费了这么多时间; - /