Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/40.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 角度2意外令牌错误_Javascript_Node.js_Angular_Typescript - Fatal编程技术网

Javascript 角度2意外令牌错误

Javascript 角度2意外令牌错误,javascript,node.js,angular,typescript,Javascript,Node.js,Angular,Typescript,所以我更新了nodejs,在那之前。angular 2没有收到错误,它工作正常,但现在更新节点_模块,它停止工作,我不知道错误在哪里,也不知道如何修复它 (index):29 Error: (SystemJS) Unexpected token < SyntaxError: Unexpected token < at eval (<anonymous>) at Object.eval (http://localhost:3000/a

所以我更新了nodejs,在那之前。angular 2没有收到错误,它工作正常,但现在更新节点_模块,它停止工作,我不知道错误在哪里,也不知道如何修复它

(index):29 Error: (SystemJS) Unexpected token <
    SyntaxError: Unexpected token <
        at eval (<anonymous>)
        at Object.eval (http://localhost:3000/app/services/authentication.service.js:15:22)
        at eval (http://localhost:3000/app/services/authentication.service.js:70:4)
        at eval (http://localhost:3000/app/services/authentication.service.js:71:3)
    Evaluating http://localhost:3000/node_modules/angular2-jwt/angular2-jwt.js
    Evaluating http://localhost:3000/app/services/authentication.service.js
    Evaluating http://localhost:3000/app/profile/profile.component.js
    Evaluating http://localhost:3000/app/app.module.js
    Evaluating http://localhost:3000/app/main.js
    Error loading http://localhost:3000/app/main.js
        at eval (<anonymous>)
        at Object.eval (http://localhost:3000/app/services/authentication.service.js:15:22)
        at eval (http://localhost:3000/app/services/authentication.service.js:70:4)
        at eval (http://localhost:3000/app/services/authentication.service.js:71:3)
    Evaluating http://localhost:3000/node_modules/angular2-jwt/angular2-jwt.js
    Evaluating http://localhost:3000/app/services/authentication.service.js
    Evaluating http://localhost:3000/app/profile/profile.component.js
    Evaluating http://localhost:3000/app/app.module.js
    Evaluating http://localhost:3000/app/main.js
    Error loading http://localhost:3000/app/main.js
index.html

<html>
  <head>
    <title>Vietnam Films</title>
    <base href="/">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="node_modules/bootstrap/dist/css/bootstrap.css">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css">
    <link rel="stylesheet" href="assets/ecommerce.css">

    <!-- 1. Load libraries -->
     <!-- Polyfill(s) for older browsers -->
    <script src="node_modules/core-js/client/shim.min.js"></script>

    <script src="node_modules/zone.js/dist/zone.js"></script>
    <script src="node_modules/reflect-metadata/Reflect.js"></script>
    <script src="node_modules/systemjs/dist/system.src.js"></script>

    <script src="node_modules/jquery/dist/jquery.min.js"></script>
    <script src="node_modules/tether/dist/js/tether.min.js"></script>
    <script src="node_modules/bootstrap/dist/js/bootstrap.js"></script>
    <script src="https://www.paypalobjects.com/api/checkout.js"></script>



    <!-- 2. Configure SystemJS -->
    <script src="systemjs.config.js"></script>
    <script>
      System.import('app').catch(function(err){ console.error(err);  });
    </script>
    <script src="//cdn.auth0.com/js/lock-9.0.min.js"></script>
  </head>

  <!-- 3. Display the application -->
  <body>
    <my-app></my-app>



    <div class="loading">
      <h1>Loading...</h1>
    </div>


  </body>
</html>

开发工具是你的朋友。在访问页面时打开Chrome开发工具,并检查网络选项卡。看看每个人的要求。我猜
http://localhost:3000/app/services/authentication.service.js
request没有返回您希望的javascript,而是返回一个HTML错误页面。看看那个错误是什么,你就会找到罪魁祸首。很可能根本找不到文件(HTTP 404),但最好检查错误


如果是404,请确保authentication.service.js正确地位于您提供服务的应用程序/服务目录中。

您很有可能在某些文件上实际收到404 not found错误。当然,对于Angular,我们应该将404重定向到index.html页面,这可能是正确的。若要查看是否存在这种情况,请将Web服务器配置为实际返回404,以查看丢失的文件。或者查看浏览器开发工具中的网络流量,查看是否有任何请求返回index.html页面而不是正确的文件。我最终发现错误,chrome浏览器控制台太模糊,我查看firefox控制台,它说我缺少一个节点模块。
<html>
  <head>
    <title>Vietnam Films</title>
    <base href="/">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="node_modules/bootstrap/dist/css/bootstrap.css">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css">
    <link rel="stylesheet" href="assets/ecommerce.css">

    <!-- 1. Load libraries -->
     <!-- Polyfill(s) for older browsers -->
    <script src="node_modules/core-js/client/shim.min.js"></script>

    <script src="node_modules/zone.js/dist/zone.js"></script>
    <script src="node_modules/reflect-metadata/Reflect.js"></script>
    <script src="node_modules/systemjs/dist/system.src.js"></script>

    <script src="node_modules/jquery/dist/jquery.min.js"></script>
    <script src="node_modules/tether/dist/js/tether.min.js"></script>
    <script src="node_modules/bootstrap/dist/js/bootstrap.js"></script>
    <script src="https://www.paypalobjects.com/api/checkout.js"></script>



    <!-- 2. Configure SystemJS -->
    <script src="systemjs.config.js"></script>
    <script>
      System.import('app').catch(function(err){ console.error(err);  });
    </script>
    <script src="//cdn.auth0.com/js/lock-9.0.min.js"></script>
  </head>

  <!-- 3. Display the application -->
  <body>
    <my-app></my-app>



    <div class="loading">
      <h1>Loading...</h1>
    </div>


  </body>
</html>
{
  "compilerOptions": {
    "module": "commonjs",
    "target": "es5",
    "sourceMap": true
  },
  "exclude": [
    "node_modules"
  ]
}