1

I'm using meteor and I ran npm install request to get access to that library. Everything seems to install correctly but when I run the meteor server, I then get the following error. Is there any word on why this is or how to solve it? Thanks.

While building the application:
node_modules/request/node_modules/node-uuid/test/test.html:1: bad formatting in HTML template
node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/run.js:1:15: Unexpected token ILLEGAL
node_modules/request/node_modules/form-data/node_modules/combined-stream/test/run.js:1:15: Unexpected token ILLEGAL

For reference:

test.html

<html>
  <head>
    <style>
      div {
        font-family: monospace;
        font-size: 8pt;
      }
      div.log {color: #444;}
      div.warn {color: #550;}
      div.error {color: #800; font-weight: bold;}
    </style>
    <script src="../uuid.js"></script>
  </head>
  <body>
    <script src="./test.js"></script>
  </body>
</html>

run.js (same)

#!/usr/bin/env node
var far = require('far').create();

far.add(__dirname);
far.include(/test-.*\.js$/);

far.execute();
user592419
  • 5,103
  • 9
  • 42
  • 67

2 Answers2

1

Meteor constructs the entire DOM itself so it will typically reject any script tags included in the html (but it will include scripts in the head, thanks Andrew). It also only supports handlebars style templating (right now).

<html>
  <head>
  <title>Something</title>
  </head>
  <body>
    {{>yourHandlebarsTemplate}}
  </body>
</html>

My advice would be to have your js and css located as files inside the client folder under your projects root.

As for NPM request, you will not be able to:

  1. install it normally like you do in most node projects, so node_module is out/npm install require is out
  2. access the functions in it without a Npm.require

At this point you have two options: adding the package NPM from Atmosphere(unofficial package repository) and including request. Or try placing the lib into /packages/ and then using Npm.require('request').

Alternatively you can just use Meteor's built in HTTP package (meteor add http) which functions similar to request.

Pent
  • 1,049
  • 15
  • 17
  • 1
    You can definitely include ` – Andrew Mao Oct 30 '13 at 03:10
  • I have the same issue with the `request` module (and it has nothing to do with the HTML/script stuff... that part is completely unrelated). Can you expand on why one isn't able to [use it like other npm modules with Meteor](http://stackoverflow.com/a/15351543/1269037)? – Dan Dascalescu Dec 20 '13 at 15:32
0

Remove from your template as it seems Meteor wants to create this tag for you when building the template. This should take care of the "bad formatting in HTML template" error in test.html.

Marco Lüthy
  • 1,279
  • 1
  • 11
  • 21