sintaxi / harp

Static Web Server/Generator/Bundler
http://harpjs.com
5k stars 346 forks source link

harp compile produces an error which references Nan #592

Closed ericjim closed 7 years ago

ericjim commented 7 years ago

I am trying to compile my site, and I get the following error:

> harp compile "./"

"Parse Error: <v8::String, std::string>(std::string)</li>\n<li>Added NanNew<v8::String, std::string&>(std::string&amp;)</li>\n<li>Added NanAsciiString helper class</li>\n<li>Added NanUtf8String helper class</li>\n<li>Added NanUcs2String helper class</li>\n<li>Deprecated NanRawString()</li>\n<li>Deprecated NanCString()</li>\n<li>Added NanGetIsolateData(v8::Isolate *isolate)</li>\n<li>Added NanMakeCallback(v8::Handle<v8::Object> target, v8::Handle<v8::Function> func, int argc, v8::Handle<v8::Value>* argv)</li>\n<li>Added NanMakeCallback(v8::Handle<v8::Object> target, v8::Handle<v8::String> symbol, int argc, v8::Handle<v8::Value>* argv)</li>\n<li>Added NanMakeCallback(v8::Handle<v8::Object> target, const char<em> method, int argc, v8::Handle<v8::Value></em> argv)</li>\n<li>Added NanSetTemplate(v8::Handle<v8::Template> templ, v8::Handle<v8::String> name , v8::Handle<v8::Data> value, v8::PropertyAttribute attributes)</li>\n<li>Added NanSetPrototypeTemplate(v8::Local<v8::FunctionTemplate> templ, v8::Handle<v8::String> name, v8::Handle<v8::Data> value, v8::PropertyAttribute attributes)</li>\n<li>Added NanSetInstanceTemplate(v8::Local<v8::FunctionTemplate> templ, const char *name, v8::Handle<v8::Data> value)</li>\n<li>Added NanSetInstanceTemplate(v8::Local<v8::FunctionTemplate> templ, v8::Handle<v8::String> name, v8::Handle<v8::Data> value, v8::PropertyAttribute attributes)</li>\n</ul>\n<h3>1.2.0 Jun 5 2014</h3><ul>\n<li>Add NanSetPrototypeTemplate</li>\n<li>Changed NAN_WEAK_CALLBACK internals, switched _NanWeakCallbackData to class,\n  introduced _NanWeakCallbackDispatcher</li>\n<li>Removed -Wno-unused-local-typedefs from test builds</li>\n<li>Made test builds Windows compatible (&#39;Sleep()&#39;)</li>\n</ul>\n<h3>1.1.2 May 28 2014</h3><ul>\n<li>Release to fix more stuff-ups in 1.1.1</li>\n</ul>\n<h3>1.1.1 May 28 2014</h3><ul>\n<li>Release to fix version mismatch in nan.h and lack of changelog entry for 1.1.0</li>\n</ul>\n<h3>1.1.0 May 25 2014</h3><ul>\n<li>Remove nan_isolate, use v8::Isolate::GetCurrent() internally instead</li>\n<li>Additional explicit overloads for NanNew(): (char<em>,int), (uint8_t</em>[,int]),\n  (uint16_t<em>[,int), double, int, unsigned int, bool, v8::String::ExternalStringResource</em>,\n  v8::String::ExternalAsciiStringResource*</li>\n<li>Deprecate NanSymbol()</li>\n<li>Added SetErrorMessage() and ErrorMessage() to NanAsyncWorker</li>\n</ul>\n<h3>1.0.0 May 4 2014</h3><ul>\n<li>Heavy API changes for V8 3.25 / Node 0.11.13</li>\n<li>Use cpplint.py</li>\n<li>Removed NanInitPersistent</li>\n<li>Removed NanPersistentToLocal</li>\n<li>Removed NanFromV8String</li>\n<li>Removed NanMakeWeak</li>\n<li>Removed NanNewLocal</li>\n<li>Removed NAN_WEAK_CALLBACK_OBJECT</li>\n<li>Removed NAN_WEAK_CALLBACK_DATA</li>\n<li>Introduce NanNew, replaces NanNewLocal, NanPersistentToLocal, adds many overloaded typed versions</li>\n<li>Introduce NanUndefined, NanNull, NanTrue and NanFalse</li>\n<li>Introduce NanEscapableScope and NanEscapeScope</li>\n<li>Introduce NanMakeWeakPersistent (requires a special callback to work on both old and new node)</li>\n<li>Introduce NanMakeCallback for node::MakeCallback</li>\n<li>Introduce NanSetTemplate</li>\n<li>Introduce NanGetCurrentContext</li>\n<li>Introduce NanCompileScript and NanRunScript</li>\n<li>Introduce NanAdjustExternalMemory</li>\n<li>Introduce NanAddGCEpilogueCallback, NanAddGCPrologueCallback, NanRemoveGCEpilogueCallback, NanRemoveGCPrologueCallback</li>\n<li>Introduce NanGetHeapStatistics</li>\n<li>Rename NanAsyncWorker#SavePersistent() to SaveToPersistent()</li>\n</ul>\n<h3>0.8.0 Jan 9 2014</h3><ul>\n<li>NanDispose -&gt; NanDisposePersistent, deprecate NanDispose</li>\n<li>Extract <em>NAN</em><em>_RETURN<em>TYPE, pull up NAN</em></em>()</li>\n</ul>\n<h3>0.7.1 Jan 9 2014</h3><ul>\n<li>Fixes to work against debug builds of Node</li>\n<li>Safer NanPersistentToLocal (avoid reinterpret_cast)</li>\n<li>Speed up common NanRawString case by only extracting flattened string when necessary</li>\n</ul>\n<h3>0.7.0 Dec 17 2013</h3><ul>\n<li>New no-arg form of NanCallback() constructor.</li>\n<li>NanCallback#Call takes Handle rather than Local</li>\n<li>Removed deprecated NanCallback#Run method, use NanCallback#Call instead</li>\n<li>Split off <em>NAN</em><em>_ARGS_TYPE from <em>NAN</em></em>_ARGS</li>\n<li>Restore (unofficial) Node 0.6 compatibility at NanCallback#Call()</li>\n<li>Introduce NanRawString() for char<em> (or appropriate void</em>) from v8::String\n  (replacement for NanFromV8String)</li>\n<li>Introduce NanCString() for null-terminated char* from v8::String</li>\n</ul>\n<h3>0.6.0 Nov 21 2013</h3><ul>\n<li>Introduce NanNewLocal<T>(v8::Handle<T> value) for use in place of\n  v8::Local<T>::New(...) since v8 started requiring isolate in Node 0.11.9</li>\n</ul>\n<h3>0.5.2 Nov 16 2013</h3><ul>\n<li>Convert SavePersistent and GetFromPersistent in NanAsyncWorker from protected and public</li>\n</ul>\n<h3>0.5.1 Nov 12 2013</h3><ul>\n<li>Use node::MakeCallback() instead of direct v8::Function::Call()</li>\n</ul>\n<h3>0.5.0 Nov 11 2013</h3><ul>\n<li>Added @TooTallNate as collaborator</li>\n<li>New, much simpler, &quot;include_dirs&quot; for binding.gyp</li>\n<li>Added full range of NAN<em>INDEX</em><em> macros to match NAN<em>PROPERTY</em></em> macros</li>\n</ul>\n<h3>0.4.4 Nov 2 2013</h3><ul>\n<li>Isolate argument from v8::Persistent::MakeWeak removed for 0.11.8+</li>\n</ul>\n<h3>0.4.3 Nov 2 2013</h3><ul>\n<li>Include node_object_wrap.h, removed from node.h for Node 0.11.8.</li>\n</ul>\n<h3>0.4.2 Nov 2 2013</h3><ul>\n<li>Handle deprecation of v8::Persistent::Dispose(v8::Isolate* isolate)) for\n  Node 0.11.8 release.</li>\n</ul>\n<h3>0.4.1 Sep 16 2013</h3><ul>\n<li>Added explicit <code>#include &lt;uv.h&gt;</code> as it was removed from node.h for v0.11.8</li>\n</ul>\n<h3>0.4.0 Sep 2 2013</h3><ul>\n<li>Added NAN_INLINE and NAN_DEPRECATED and made use of them</li>\n<li>Added NanError, NanTypeError and NanRangeError</li>\n<li>Cleaned up code</li>\n</ul>\n<h3>0.3.2 Aug 30 2013</h3><ul>\n<li>Fix missing scope declaration in GetFromPersistent() and SaveToPersistent\n  in NanAsyncWorker</li>\n</ul>\n<h3>0.3.1 Aug 20 2013</h3><ul>\n<li>fix &quot;not all control paths return a value&quot; compile warning on some platforms</li>\n</ul>\n<h3>0.3.0 Aug 19 2013</h3><ul>\n<li>Made NAN work with NPM</li>\n<li>Lots of fixes to NanFromV8String, pulling in features from new Node core</li>\n<li>Changed node::encoding to Nan::Encoding in NanFromV8String to unify the API</li>\n<li>Added optional error number argument for NanThrowError()</li>\n<li>Added NanInitPersistent()</li>\n<li>Added NanReturnNull() and NanReturnEmptyString()</li>\n<li>Added NanLocker and NanUnlocker</li>\n<li>Added missing scopes</li>\n<li>Made sure to clear disposed Persistent handles</li>\n<li>Changed NanAsyncWorker to allocate error messages on the heap</li>\n<li>Changed NanThrowError(Local<Value>) to NanThrowError(Handle<Value>)</li>\n<li>Fixed leak in NanAsyncWorker when errmsg is used</li>\n</ul>\n<h3>0.2.2 Aug 5 2013</h3><ul>\n<li>Fixed usage of undefined variable with node::BASE64 in NanFromV8String()</li>\n</ul>\n<h3>0.2.1 Aug 5 2013</h3><ul>\n<li>Fixed 0.8 breakage, node::BUFFER encoding type not available in 0.8 for\n  NanFromV8String()</li>\n</ul>\n<h3>0.2.0 Aug 5 2013</h3><ul>\n<li>Added NAN_PROPERTY_GETTER, NAN_PROPERTY_SETTER, NAN_PROPERTY_ENUMERATOR,\n  NAN_PROPERTY_DELETER, NAN_PROPERTY_QUERY</li>\n<li>Extracted _NAN_METHOD_ARGS, _NAN_GETTER_ARGS, _NAN_SETTER_ARGS,\n  _NAN_PROPERTY_GETTER_ARGS, _NAN_PROPERTY_SETTER_ARGS,\n  _NAN_PROPERTY_ENUMERATOR_ARGS, _NAN_PROPERTY_DELETER_ARGS,\n  _NAN_PROPERTY_QUERY_ARGS</li>\n<li>Added NanGetInternalFieldPointer, NanSetInternalFieldPointer</li>\n<li>Added NAN_WEAK_CALLBACK, NAN_WEAK_CALLBACK_OBJECT,\n  NAN_WEAK_CALLBACK_DATA, NanMakeWeak</li>\n<li>Renamed THROW_ERROR to _NAN_THROW_ERROR</li>\n<li>Added NanNewBufferHandle(char<em>, size_t, node::smalloc::FreeCallback, void</em>)</li>\n<li>Added NanBufferUse(char*, uint32_t)</li>\n<li>Added NanNewContextHandle(v8::ExtensionConfiguration*,<pre><code>v8::Handle&lt;v8::ObjectTemplate&gt;, v8::Handle&lt;v8::Value&gt;)\n</code></pre></li>\n<li>Fixed broken NanCallback#GetFunction()</li>\n<li>Added optional encoding and size arguments to NanFromV8String()</li>\n<li>Added NanGetPointerSafe() and NanSetPointerSafe()</li>\n<li>Added initial test suite (to be expanded)</li>\n<li>Allow NanUInt32OptionValue to convert any Number object</li>\n</ul>\n<h3>0.1.0 Jul 21 2013</h3><ul>\n<li>Added <code>NAN_GETTER</code>, <code>NAN_SETTER</code></li>\n<li>Added <code>NanThrowError</code> with single Local<Value> argument</li>\n<li>Added <code>NanNewBufferHandle</code> with single uint32_t argument</li>\n<li>Added <code>NanHasInstance(Persistent&lt;FunctionTemplate&gt;&amp;, Handle&lt;Value&gt;)</code></li>\n<li>Added <code>Local&lt;Function&gt; NanCallback#GetFunction()</code></li>\n<li>Added <code>NanCallback#Call(int, Local&lt;Value&gt;[])</code></li>\n<li>Deprecated <code>NanCallback#Run(int, Local&lt;Value&gt;[])</code> in favour of Call</li>\n</ul>"

My setup:

Has anyone seen this before? We are using Harp to host the Angular Augury site (source) cc @mobinni

sintaxi commented 7 years ago

Just published harp@0.23.0. Do you mind seeing if you still get this error?

ericjim commented 7 years ago

@sintaxi Just tried harp@0.23.0, I still get the same result. It might be worth noting that harp server runs and I can view all my pages. I will be systematically removing parts of the site, to see if the Parse Error: still occurs. It's also worth noting that I am using .ejs files.

ericjim commented 7 years ago

@sintaxi I think I sorted out what the problem was. My node_modules exist at the root level of my project along with my site files, my guess is that when I run harp compile Harp will try to compile something it doesn't understand. To solve this issue, i've separated my site and my dependencies by placing my .ejs files in a src folder, and then running harp compile ./src

sintaxi commented 7 years ago

Ok great. Thanks a lot for testing.

danwaz commented 7 years ago

Thanks @ericjim. I was experiencing the same issue. Removing my node_modules from the src directory did the trick!