Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues with transform exercise on Windows #28

Open
marcinwasilewski opened this issue May 2, 2017 · 0 comments
Open

Issues with transform exercise on Windows #28

marcinwasilewski opened this issue May 2, 2017 · 0 comments

Comments

@marcinwasilewski
Copy link

I tried to run the official solution for transforms exercise which in my case should look as follows:

  var fs = require('fs');                                                                                                                           
  var txt = fs.readFileSync('C:\Users\marcin\AppData\Roaming\npm\node_modules\browserify-adventure\problems\using_transforms\wake.txt', 'utf8');    
  var sprintf = require('sprintf');                                                                                                                 
                                                                                                                                                    
  var lines = txt.split('\n');                                                                                                                      
  lines.forEach(function (line, index) {                                                                                                            
      if (index % 5 === 0) {                                                                                                                        
          console.log(sprintf('%3d %s', index, line));                                                                                              
      }                                                                                                                                             
      else {                                                                                                                                        
          console.log('    ' + line);                                                                                                               
      }                                                                                                                                             
  });       

That however produces a SyntaxError:

TAP version 13
SyntaxError: Bad character escape sequence (2:28) while parsing file: C:\Users\marcin\node-stuff\browserify-adventure\main.js
    at Parser.pp.raise (C:\Users\marcin\node-stuff\browserify-adventure\node_modules\acorn\dist\acorn.js:1745:13)
    at Parser.pp.readHexChar (C:\Users\marcin\node-stuff\browserify-adventure\node_modules\acorn\dist\acorn.js:3762:24)
    at Parser.pp.readCodePoint (C:\Users\marcin\node-stuff\browserify-adventure\node_modules\acorn\dist\acorn.js:3631:17)
    at Parser.pp.readEscapedChar (C:\Users\marcin\node-stuff\browserify-adventure\node_modules\acorn\dist\acorn.js:3733:39)
    at Parser.pp.readString (C:\Users\marcin\node-stuff\browserify-adventure\node_modules\acorn\dist\acorn.js:3653:19)
    at Parser.pp.getTokenFromCode (C:\Users\marcin\node-stuff\browserify-adventure\node_modules\acorn\dist\acorn.js:3446:19)
    at Parser.pp.readToken (C:\Users\marcin\node-stuff\browserify-adventure\node_modules\acorn\dist\acorn.js:3189:15)
    at Parser.pp.nextToken (C:\Users\marcin\node-stuff\browserify-adventure\node_modules\acorn\dist\acorn.js:3181:71)
    at Parser.pp.next (C:\Users\marcin\node-stuff\browserify-adventure\node_modules\acorn\dist\acorn.js:3130:8)
    at Parser.pp.eat (C:\Users\marcin\node-stuff\browserify-adventure\node_modules\acorn\dist\acorn.js:2201:10)
# (anonymous)

None of the lines are marked as correct either:

not ok 1 should be equal                                                                   
  ---                                                                                      
    operator: equal                                                                        
    expected:                                                                              
      '0 Be that as it may, but for that light phantastic of his gnose\'s glow as it'      
    actual:                                                                                
      ''                                                                                   
  ...                                                                                      
not ok 2 should be equal                                                                   
  ---                                                                                      
    operator: equal                                                                        
    expected:                                                                              
      '    slid lucifericiously within an inch of its page (he touch at its from time'     
    actual:                                                                                
      undefined                                                                            
  ...         

(...)                                                                             

For some reason saving the file wake.txt to a local directory and changing the path to relative in readFileSync solves the issue.

var txt = fs.readFileSync('wake.txt', 'utf8');

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant