title: Docker :: Node Hello World Example :: SyntaxError: Invalid or unexpected token?
body: <p>I am trying to run this hello world example on node within a docker container</p>
  
  <p><a href="https://medium.com/@adnanrahic/hello-world-app-with-node-js-and-express-c1eb7cfa8a30" rel="nofollow noreferrer">https://medium.com/@adnanrahic/hello-world-app-with-node-js-and-express-c1eb7cfa8a30</a></p>
  
  <p>Here is my dockerfile:</p>
  
  <pre><code>#escape=`
  FROM microsoft/nanoserver
  
  ADD https://nodejs.org/dist/v8.11.1/node-v8.11.1-win-x64.zip C:\node-v8.11.1-win-x64.zip
  
  RUN powershell -Command Expand-Archive C:\node-v8.11.1-win-x64.zip C:\; Rename-Item C:\node-v8.11.1-win-x64 node; `
  SETX PATH C:\node;
  
  SHELL ["powershell", "-Command"]
  
  RUN mkdir hello-world; `
      cd c:\hello-world; `
      npm init -f; `
      (Get-Content C:\hello-world\package.json) | `
      ForEach-Object { $_ -replace 'index.js', 'app.js' } | `
      Set-Content C:\hello-world\package.json; `
      npm install express --save; `
      echo \""var express = require('express');\"" &gt; app.js; `
      echo \""var app = express();\"" &gt;&gt; app.js; `
      echo \""app.get('/', function (req, res) {\"" &gt;&gt; app.js; `
      echo \""  res.send('Hello World!');\"" &gt;&gt; app.js; `
      echo \""});\"" &gt;&gt; app.js; `
      echo \""app.listen(3000, function () {\"" &gt;&gt; app.js; `
      echo \""  console.log('Example app listening on port 3000!');\"" &gt;&gt; app.js; `
      echo \""});\"" &gt;&gt; app.js; `
      del c:\node-v8.11.1-win-x64.zip
  
  EXPOSE 3000
  
  ENTRYPOINT node c:\hello-world\app.js
  </code></pre>
  
  <p>after building the container successsfully:</p>
  
  <pre><code>docker build . -t nano-node-hw
  </code></pre>
  
  <p>and run it, I get the following error:</p>
  
  <pre><code>PS C:\Users\user\Docker\Node&gt; docker run -it -p 3000:3000 --name node-hello nano-node-hw
  c:\hello-world\app.js:1
  (function (exports, require, module, __filename, __dirname) { ??v
                                                                ^
  
  SyntaxError: Invalid or unexpected token
      at createScript (vm.js:80:10)
      at Object.runInThisContext (vm.js:139:10)
      at Module._compile (module.js:616:28)
      at Object.Module._extensions..js (module.js:663:10)
      at Module.load (module.js:565:32)
      at tryModuleLoad (module.js:505:12)
      at Function.Module._load (module.js:497:3)
      at Function.Module.runMain (module.js:693:10)
      at startup (bootstrap_node.js:188:16)
      at bootstrap_node.js:609:3
  </code></pre>
  
  <p>I did these same steps on my laptop (Windows 10) running node locally and had no issues.. what gives??</p>