我正在使用Ionic v2开发Visual Studio 2017,我正在尝试编写一个扫描信标的应用程序。但每次我安装插件时,我都会从npm获得有关节点版本和npm本身的错误。 我目前的版本:
Cordova version: 7.0.1
Npm version: 5.0.3
Node version: 8.1.3
例如我安装了cordova bluetoothle插件,这就是我得到的错误:
npm ERR! node v5.4.1
npm ERR! npm v3.3.4
npm ERR! code ELIFECYCLE
npm ERR! io.cordova.myappd95ddb@ build: `ionic-app-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the io.cordova.myappd95ddb@ build script 'ionic-app-
scripts build'.
npm ERR! This is most likely a problem with the io.cordova.myappd95ddb
package,
npm ERR! not with npm itself.
我在互联网上看了一下,但显然没有很多可以与蓝牙配合使用的更新插件,这是否意味着我必须降级我的节点和npm版本? 你知道我可以使用的任何其他插件吗?
NPM-的debug.log:
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\Web\\External\\Node.exe',
1 verbose cli 'C:\\Program Files (x86)\\Microsoft Visual
Studio\\2017\\Community\\Web\\External\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'build',
1 verbose cli '--color=always' ]
2 info using npm@3.3.4
3 info using node@v5.4.1
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle io.cordova.myappd95ddb@~prebuild: io.cordova.myappd95ddb@
6 silly lifecycle io.cordova.myappd95ddb@~prebuild: no script for prebuild, continuing
7 info lifecycle io.cordova.myappd95ddb@~build: io.cordova.myappd95ddb@
8 verbose lifecycle io.cordova.myappd95ddb@~build: unsafe-perm in lifecycle true
9 verbose lifecycle io.cordova.myappd95ddb@~build: PATH: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Web\External\node_modules\npm\bin\node-gyp-bin;C:\Users\giuli\Documents\Visual Studio 2017\Projects\test\test\node_modules\.bin;.\node_modules\.bin;C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2017\COMMUNITY\Web\External;C:\Program Files\Java\jdk1.7.0_79\bin;C:\Program Files\Git\cmd;C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files (x86)\Bitvise SSH Client;C:\Program Files\MATLAB\R2016a\runtime\win64;C:\Program Files\MATLAB\R2016a\bin;C:\Program Files (x86)\PuTTY\;C:\Program Files\nodejs\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Users\giuli\AppData\Local\Microsoft\WindowsApps;C:\Users\giuli\AppData\Roaming\npm;C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git\mingw32\bin;C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git\cmd;C:\Program Files\nodejs
10 verbose lifecycle io.cordova.myappd95ddb@~build: CWD: C:\Users\giuli\Documents\Visual Studio 2017\Projects\test\test
11 silly lifecycle io.cordova.myappd95ddb@~build: Args: [ '/d /s /c', 'ionic-app-scripts build' ]
12 silly lifecycle io.cordova.myappd95ddb@~build: Returned: code: 1 signal: null
13 info lifecycle io.cordova.myappd95ddb@~build: Failed to exec build script
14 verbose stack Error: io.cordova.myappd95ddb@ build: `ionic-app-scripts build`
14 verbose stack Exit status 1
14 verbose stack at EventEmitter.<anonymous> (C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Web\External\node_modules\npm\lib\utils\lifecycle.js:233:16)
14 verbose stack at emitTwo (events.js:87:13)
14 verbose stack at EventEmitter.emit (events.js:172:7)
14 verbose stack at ChildProcess.<anonymous> (C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Web\External\node_modules\npm\lib\utils\spawn.js:24:14)
14 verbose stack at emitTwo (events.js:87:13)
14 verbose stack at ChildProcess.emit (events.js:172:7)
14 verbose stack at maybeClose (internal/child_process.js:821:16)
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
15 verbose pkgid io.cordova.myappd95ddb@
16 verbose cwd C:\Users\giuli\Documents\Visual Studio 2017\Projects\test\test
17 error Windows_NT 10.0.15063
18 error argv "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\Web\\External\\Node.exe" "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\Web\\External\\node_modules\\npm\\bin\\npm-cli.js" "run" "build" "--color=always"
19 error node v5.4.1
20 error npm v3.3.4
21 error code ELIFECYCLE
22 error io.cordova.myappd95ddb@ build: `ionic-app-scripts build`
22 error Exit status 1
23 error Failed at the io.cordova.myappd95ddb@ build script 'ionic-app-scripts build'.
23 error This is most likely a problem with the io.cordova.myappd95ddb package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error ionic-app-scripts build
23 error You can get their info via:
23 error npm owner ls io.cordova.myappd95ddb
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]
答案 0 :(得分:1)
解决方法如下:在Vs中打开工具/选项/项目和解决方案/外部Web包。将$ PATH移到../ external。
之上