question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

format and test scripts generate SyntaxErrors

See original GitHub issue

Seems reproducible with any new noderize app create, even after successful build/watch, initially running…

yarn format generates a SyntaxError via @noderize\scripts\node_modules\.bin\prettier and args handling? yarn test generates a SyntaxError via @noderize\scripts\node_modules\.bin\jest and args handling?

λ yarn format
yarn run v1.5.1
$ noderize-scripts format
[INFO] Formatting...
c:\projects\typescript\first-noderize\node_modules\@noderize\scripts\node_modules\.bin\prettier:2
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
          ^^^^^^^

SyntaxError: missing ) after argument list
    at new Script (vm.js:51:7)
    at createScript (vm.js:136:10)
    at Object.runInThisContext (vm.js:197:10)
    at Module._compile (module.js:613:28)
    at Object.Module._extensions..js (module.js:660:10)
    at Module.load (module.js:561:32)
    at tryModuleLoad (module.js:501:12)
    at Function.Module._load (module.js:493:3)
    at Function.Module.runMain (module.js:690:10)
    at startup (bootstrap_node.js:194:16)
[WARN] Done formatting!
Done in 1.67s.
λ yarn test
yarn run v1.5.1
$ noderize-scripts test
[INFO] Testing...
The system cannot find the path specified.
c:\projects\typescript\first-noderize\node_modules\@noderize\scripts\node_modules\.bin\jest:2
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
          ^^^^^^^

SyntaxError: missing ) after argument list
    at new Script (vm.js:51:7)
    at createScript (vm.js:136:10)
    at Object.runInThisContext (vm.js:197:10)
    at Module._compile (module.js:613:28)
    at Object.Module._extensions..js (module.js:660:10)
    at Module.load (module.js:561:32)
    at tryModuleLoad (module.js:501:12)
    at Function.Module._load (module.js:493:3)
    at Function.Module.runMain (module.js:690:10)
    at startup (bootstrap_node.js:194:16)
Done in 1.75s.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:23 (23 by maintainers)

github_iconTop GitHub Comments

2reactions
sc0ttwad3commented, Mar 24, 2018

The core issue seems to come down to npm assuming the command passed to it is a JS file–somewhere in the complicated script calling script decomposition into commands and args at work here–this is however not true on Windows where npm wraps bin files in a .cmd file.

Since npm can not parse .cmd files–where our SyntaxError: issue is coming from–you need to reference the bin file manually in the package.json scripts section as part of a script.

And in order to use this cross platform (i.e. Linux, Mac and Windows), you need to change the path from the form:

node_modules/.bin/<some_name>

to the full location and adding the .js file extension:

node_modules/<some_name>/bin/<some_name>.js

At least that’s my current understanding of the issue.

1reaction
sc0ttwad3commented, Apr 2, 2018

@cretezy Thanks. Havent had as much time for anything past work, but with prepack working, Im looking at a couple new things I ran across for the cross platform issues. I get anywhere with it, Ill let you know.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Understand and Resolve Syntax Errors in a Template or Script
When HotDocs encounters a component or instruction in a template or script that it doesn't recognize or understand, it generates and displays a...
Read more >
Syntax Error - an overview | ScienceDirect Topics
Syntax errors are mistakes in the source code, such as misspelling of an instruction mnemonic or failure to declare a label before using...
Read more >
Syntax Errors in Coding and What You Can Do to Fix Them
A syntax error commonly occurs in coding when the coder has typed in something incorrectly. Syntax errors are easy to find and fix....
Read more >
Script syntax error checking
All script fields provide controls for checking the syntax for errors and for locating the error easily when one occurs.
Read more >
Common SQL syntax errors and how to resolve them
In this article, we are going to describe some of the most common SQL syntax errors, and explains how you can resolve these...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found