NPM Unexpected end of JSON input while parsing near

npm install 报错:

1.NPM Unexpected end of JSON input while parsing near
2.npm ERR! A complete log of this run can be found in:

解决办法:

first:

npm install --registry=https://registry.npm.taobao.org --loglevel=silly
then:

npm cache clean --force
 

展开阅读全文

unexpected end of file found

10-30

#include "stdlib.h"rn#include "string.h"rn#include "iostream.h" #include "stdafx.h" #define MAX 100rntypedef struct //声明堆栈结构rnrn int stack[MAX]; //栈顶指针rn int top; //栈顶数据rnsqstack;rnsqstack operator,operand;rn//存入堆栈数据rnint push(sqstack *s,int value)rnrn if(s->top=MAX-1)rn return 0;rn s->top++;rn s->stack[s->top]=value;rn return 1;rnrn//从堆栈中取出数据rnint pop(sqstack *s)rnrn int x;rn if(s->top<0)rn return NULL;rn x=s->stack[s->top];rn s->top--;rn return x;rnrn//检查堆栈是否为空rnint empty(sqstack *s)rnrn if(s->top<0)rn return 1;rn else rn return 0;rnrn//判断是否为运算符rnint is_oprator(char operator)rnrn switch(operator) //operator是运算符rn case '+': case'-': case '*': case '/':rn return 1;rn default: rn return 0;rnrn//判断运算符的优先权rnint priority(char operator)rnrn switch(operator)rn rn case '+': case'-': rn return 1;break;rn case '*': case '/': rn return 2;break;rn default:return 0;rn rnrn//计算任意两个操作数的值rnint two_result(int operator,int operand1,int operand2)rnrn switch(operator)rn rn case '+':return (operand1+operand2);rn case '-':return (operand1-operand2);rn case '*':return (operand1*operand2);rn case '/':return (operand1/operand2);rn rnrn//主程序,输入中序表达式后计算出表达式的结果值rnvoid main()rnrn char expreession[100];rn int position=0;rn int op=0;rn int operand1=0;rn int operand2=0;rn operator->top=operand->=-1;rn cout<data)&&!empty(operator))rn rn operand1=pop(operand);rn operand2=pop(operand);rn op=pop(operator);rn oprand=push(operand,two_result(op,operand1,operand2);rn rn operator=push(operator,expression[position]);rn rn elsern operand=push(operand,expression[position]-48);rn position++;rn rn while(!empty(operator))rn rn op=pop(operator);rn oprand1=pop(operand);rn oprand2=pop(operand);rn operand=push(operand,two_result(op,operand1,operand2));rn rn evaluate=pop(operand);rn cout<<"The expression["+expression+"] result is '"+evaluate+"'"< 论坛

Unexpected error parsing /WEB-INF/web.xml

01-25

我用Eclipse - Lomboz + JSF 1.1开发一个Web Application时,不小心把Tomcat弄坏了,重新安装了一下Tomcat,结果,再在Eclipse中启动,就出现了下面这个错误。但是把整个项目拷贝到Tomcat/Webapps下面,就不会出错。这是咋回事啊,大哥们… 谢谢你们了!rnrn错误报告如下:rn严重: Unexpected error parsing /WEB-INF/web.xml: java.io.FileNotFoundExceptionrnjava.io.FileNotFoundExceptionrnat org.apache.naming.resources.DirContextURLConnection.getInputStream(DirContextURLConnection.java:297)rnat com.sun.faces.config.WebXmlParser.getFacesServletMappings(WebXmlParser.java:115)rnat com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:180)rnat org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3729)rnat org.apache.catalina.core.StandardContext.start(StandardContext.java:4187)rnat org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013)rnat org.apache.catalina.core.StandardHost.start(StandardHost.java:718)rnat org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013)rnat org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442)rnat org.apache.catalina.core.StandardService.start(StandardService.java:450)rnat org.apache.catalina.core.StandardServer.start(StandardServer.java:709)rnat org.apache.catalina.startup.Catalina.start(Catalina.java:551)rnat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rnat sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)rnat sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)rnat java.lang.reflect.Method.invoke(Unknown Source)rnat org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)rnat org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)rn2006-12-19 11:15:46 org.apache.catalina.core.StandardContext listenerStartrn严重: Exception sending context initialized event to listener instance of class com.sun.faces.config.ConfigureListenerrnjavax.faces.FacesException: Unexpected error parsing /WEB-INF/web.xml: java.io.FileNotFoundExceptionrnat com.sun.faces.config.WebXmlParser.getFacesServletMappings(WebXmlParser.java:123)rnat com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:180)rnat org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3729)rnat org.apache.catalina.core.StandardContext.start(StandardContext.java:4187)rnat org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013)rnat org.apache.catalina.core.StandardHost.start(StandardHost.java:718)rnat org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013)rnat org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442)rnat org.apache.catalina.core.StandardService.start(StandardService.java:450)rnat org.apache.catalina.core.StandardServer.start(StandardServer.java:709)rnat org.apache.catalina.startup.Catalina.start(Catalina.java:551)rnat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rnat sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)rnat sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)rnat java.lang.reflect.Method.invoke(Unknown Source)rnat org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)rnat org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)rnCaused by: java.io.FileNotFoundExceptionrnat org.apache.naming.resources.DirContextURLConnection.getInputStream(DirContextURLConnection.java:297)rnat com.sun.faces.config.WebXmlParser.getFacesServletMappings(WebXmlParser.java:115)rn... 16 more 论坛

unexpected file end

07-29

[b]a.h[/b][color=#FF6600][/color]rn#includern#include"stdAfx.h"rntypedef void(CALLBACK* ONSERIESREAD)(void* pOwner,BYTE* buf,DWORD dwBufLen);rnclass CCEseriesrnrnpublic:rn CCEseries();rn ~CCEseries();rn BOOL OpenPort(void* pOwner,UINT portNo,UINT baud,UINT parity,UINT databits,UINT stopbits);//打开串口,创建读线程来异步接收数据rn void ClosePort();//关闭串口,释放资源,关闭读线程rn BOOL WriteSyncPort(const BYTE* buf,DWORD bufLen);//想串口写入数据rn BOOL SetSeriesTimeOuts(COMMTIMEOUTS CommTimeOuts);//设置读写超时rn m_OnseriesRead();//读线程检测到有可读数据时,通过它来通知用户读取数据rn //BOOL GetComOpened()rnprivate:rn static DWORD WINAPI ReadThreadFunc(LPVOID lparam);rn void CloseReadThread();rnprivate:rn HANDLE m_hComm;rn HANDLE m_hReadThread;rn DWORD m_dwReadThreadID;rn HANDLE m_hReadCloseEvent;rn BOOL m_bOpened;rn void* m_pOwner;rnpublic:rn ONSERIESREAD m_OnSeriesRead;rn;rn[b]a.cpp[/b][color=#FF6600][/color]rn#include"串口类.h"rnCCESeries::CCESeries()rnrn //初始化内部变量rn m_hComm=INVALID_HANDLE_VALUE;rn m_OnSeriesRead=NULL;rn m_bOpened=0;rnrnCCESeries::~CCESeries()rnrn if(m_bOpened)rn rn ClosePort();rn rnrnrnDWORD CCESeries::ReadThreadFunc(LPVOID lparam)rnrn CCESeries* ceSeries=(CCESeries*)lparam;rn DWORD evtmask;rn BYTE* readBuf=NULL;rn DWORD actualReadLen=0;rn DWORD willReadLen;rn DWORD dwReadErrors;rn COMSTAT cmState;rn ASSERT(ceSeries->m_hComm!=INVALID_HANDLE_VALUE);rn PurgeComm(ceSeries->m_hComm,PURGE_RXCLEAR|PUREG_TXCLEAR);rn SetCommMask(ceSeries->m_hComm,EV_RXCHAR|EV_CTS|EV_DSR);rn while(TRUE)rn rn if(WaitCommEvent(ceSeries->m_hComm,&evtMask,0))rn rn SetCommMask(ceSeries->m_hComm,EV_RXCHAR|EV_CTS|EV_DSR);rn if(evtMask&EV_RXCHAR)rn rn ClearCommError(ceSeries->m_hComm,&dwReadErrors,&cmState);rn willReadLen=cmState.cbInque;rn if(willReadLen<=0)rn rn continue;rnrn rn readBuf=new BYTE[willReadLen];rn ZeroMemory(readBuf,willReadLen);rn ReadFile(ceSeries->m_hComm,readBuf,willReadLen,&actualReadLen,0);rn if(actualReadLen>0)rn rn if(ceSeries->m_OnSeriesRead)rn rn ceSeries->m_OnSeriesRead(ceSeries->m_pOwner,readBuf,actualReadLen);rn rn rn delete[] readBuf;rn readBuf=NULL;rnrn rn rn if(WaitForSingleObject(ceSeries->m_hReadCloseEvent,500)==WAIT_OBJECT_0)rn rn break;rn rn rn return 0;rnrnrnrnvoid CCESeries::CloseReadThread()rnrn SetEvent(m_hReadCloseEvent);rn SetCommMask(m_hComm,0);rn PurgeComm(m_hComm,PURGE_RXCLEAR);rn if(WaitForSingleObject(m_hReadThread,4000)==WAIT_TIMEOUT)rn rn TerminateThread(m_hReadThread,0);rn rn m_hReadThread=NULL;rnrnrnrnBOOL CCESeries::OpenPort(void* pOwner,UINT portNo,UINT baud,UINT parity,UINT databits,UINT stopbits)rnrn DCB commParam;rn TCHAR szPort[15];rn ASSER(pOwner!=NULL);rn m_pOwner=pOwner;rn if(m_hComm!=INVALID_HANDLE_VALUE)rn rn return TRUE;rn rn wsprintf(szPort,L"COM%d:",portNo);rn m_hComm=CreateFile(szPort,GENERIC_READ|GENERIC_WRITE,0,NULL,OPEN_EXISTING,0,NULL);rn if(m_hComm==INVALID_HANDLE_VALUE)rn rn TRACE(_T("CreateFile返回无效句柄\n"));rn return FALSE;rnrnrn rn if(!GetCommState(m_hComm,&commParam))rn rn CloseHandle(m_hComm);rn m_hComm=INVALID_HANDLE_VALUE;rn return FALSE;rn rn commParam.BaudRate=baud;rn commParam.fBinary=TRUE;rn commParam.fParity=TRUE;rn commParam.ByteSize=databits;rn commParam.Parity=parity;rn commParam.StopBits=stopbits;rn commParam.fOutxCtsFlow=FALSE;rn commParam.fOutxDsrFlow=FALSE;rn commParam.fDtrControl=DTR_CONTROL_ENABLE;rn commParam.fDsrSensitivity=FALSE;rn commParam.fTXContinueOnXoff=TRUE;rn commParam.fOutX=FALSE;rn commParam.fInX=FALSE;rncommParam.fErrorChar=FALSE;rncommParam.fNull=FALSE;rncommParam.fRtsControl=RTS_CONTROL_ENABLE;rncommParam.fAbortOnError=FALSE;rnif(!SetCommState(m_hComm,&commParam))rnrn TRACE(_T("SetCommState error"));rn CloseHandle(m_hComm);rn m_hComm=INVALID_HANDLE_VALUE;rn return FALSE;rnrnCOMMTIMEOUTS CommTimeOuts;rnGetCommTimeouts(m_hComm,&CommTimeOuts);rnCommTimeOuts.ReadIntervalTimeout=MAXDWORD;rnCommTimeOuts.ReadTotalTimeoutMultiplier=0;rnCommTimeOuts.ReadTotalTimeoutConstant=0;rnCommTimeOuts.WriteTotalTimeoutMultiplier=10;rnCommTimeOuts.WriteTotalTimeoutConstant=1000;rnif(!=SetCommTimeouts(m_hComm,&CommTimeOuts))rnrn TRACE(_T("SetCommTimeouts返回错误"));rn CloseHandle(m_hComm);rn m_hComm=INVALID_HANDLE_VALUE;rn return FALSE;rnrnSetCommMask(m_hComm,EV_RXCHAR);rnSetupComm(m_hComm,512,512);rnPurgeComm(m_hComm,PURGE_TXCLEAR|PURGE_RXCLEAR);rnCString strEvent;rnstrEvent.Format(L"Com_ReadCloseEvent%d",portNo);rnm_hReadCloseEvent=CreateEvent(NULL,TRUE,FALSE,strEvent);rnm_hReadThread=CreateThread(NULL,0,ReadThreadFunc,this,0,&m_dwReadThreadID);rnTRACE(_T(" 串口打开成功"));rnm_bOpened=TRUE;rnreturn TRUE;rnrnrnvoid CCESeries::ClosePort()rnrn if(m_hComm==INVALID_HANDLE_VALUE)rn rn return;rn rn CloseReadThread();rn CloseHandle(m_hComm);rn CloseHandle(m_hReadCloseEvent);rn m_hComm=INVALID_HANDLE_VALUE;rn m_bOpened=FALSE;rnrnrnBOOL CCESeries::WriteSyncPort(const BYTE* buf,DWORD bufLen)rnrn DWORD dwNumBytesWritten;rn DWORD dwHaveNumWritten;rn int iInc=0;rn ASSERT(m_hComm!=INVALID_HANDLE_VALUE);rn dorn rn if(WriteFile(m_hComm,buf+dwHaveNumWritten,bufLen-dwHaveNumWritten,&dwNumBytesWritten,NULL))rn rn dwHaveNumWritten=dwHaveNumWritten+dwNumBytesWritten;rn if(dwHaveNumWritten==bufLen)rn rn break;rn rn iInc++rn if(iInc>=3)rn rn return FALSE;rn rn Sleep(10);rnrn rn elsern rn return FALSE;rn rn while(TRUE);rn return TRUE;rnrnBOOL CCESeries::SetSeriesTimeouts(COMMTIMEOUTS CommTimeOuts)rnrn ASSERT(m_hComm!=INVALID_HANDLE_VALUE);rn return SetCommTimeouts(m_hComm,&CommTimeOuts);rnrnrnBOOL CCESeries::GetComOpened()rnrn return m_bOpened;rnrn最后总显示fatal error C1010: unexpected end of file while looking for precompiled header directive,CPP文件 论坛

没有更多推荐了,返回首页