Skip to content

[BUG] Error when installing: SyntaxError: Invalid or unexpected token #395

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

Closed
ngoov opened this issue Nov 30, 2017 · 10 comments
Closed

[BUG] Error when installing: SyntaxError: Invalid or unexpected token #395

ngoov opened this issue Nov 30, 2017 · 10 comments

Comments

@ngoov
Copy link

ngoov commented Nov 30, 2017

Overview of the issue

When trying to do:
npm install -g @compodoc/compodoc
or on yarn
yarn global add @compodoc/compodoc
or a local install on an angular 5.0.1 application
(tried this in both git-bash and PowerShell)

I receive a coffee-script error:

NPM:
`... $ npm install -g @compodoc/compodoc
npm WARN deprecated [email protected]: Use uuid module instead
C:\Users...\AppData\Roaming\npm\compodoc -> C:\Users...\AppData\Roaming\npm\node_modules@compodoc\compodoc\bin\index-cli.js

[email protected] postinstall C:\Users...\AppData\Roaming\npm\node_modules@compodoc\compodoc\node_modules\coffee-script
node --eval 'if (require("./package.json").name === "coffee-script") { var red, yellow, cyan, reset; red = yellow = cyan = reset = ""; if (!process.env.NODE_DISABLE_COLORS) { red = "\x1b[31m"; yellow = "\x1b[33m"; cyan = "\x1b[36m"; reset = "\x1b[0m"; } console.warn(red + "CoffeeScript has moved!" + reset + " Please update references to " + yellow + ""coffee-script"" + reset + " to use " + yellow + ""coffeescript"" + reset + " (no hyphen) instead."); console.warn("Also, a new major version has been released under the " + yellow + "coffeescript" + reset + " name on NPM. This new release targets modern JavaScript, with minimal breaking changes. Learn more at " + cyan + "http://coffeescript.org" + reset + "."); console.warn(""); }'

'if
^^^

SyntaxError: Invalid or unexpected token
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Object. (eval-wrapper:6:22)
at Module._compile (module.js:635:30)
at evalScript (bootstrap_node.js:462:27)
at startup (bootstrap_node.js:163:9)
at bootstrap_node.js:608:3
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules@compodoc\compodoc\node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: node --eval 'if (require("./package.json").name === "coffee-script") { var red, yellow, cyan, reset; red = yellow = cyan = reset = ""; if (!process.env.NODE_DISABLE_COLORS) { red = "\x1b[31m"; yellow = "\x1b[33m"; cyan = "\x1b[36m"; reset = "\x1b[0m"; } console.warn(red + "CoffeeScript has moved!" + reset + " Please update references to " + yellow + "\"coffee-script\"" + reset + " to use " + yellow + "\"coffeescript\"" + reset + " (no hyphen) instead."); console.warn("Also, a new major version has been released under the " + yellow + "coffeescript" + reset + " name on NPM. This new release targets modern JavaScript, with minimal breaking changes. Learn more at " + cyan + "http://coffeescript.org" + reset + "."); console.warn(""); }'
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! ..._logs\2017-11-30T11_15_39_557Z-debug.log`

Yarn:

`... $ yarn global add @compodoc/compodoc
yarn global v1.3.2
[1/4] Resolving packages...
warning @compodoc/compodoc > live-server > http-auth > [email protected]: Use uuid module instead
[2/4] Fetching packages...
warning Pattern ["colors@latest"] is trying to unpack in the same destination "C:\users\...\AppData\Local\Yarn\cache\v1\npm-colors-1.1.2-168a4701756b6a7f51a12ce0c97bfa28c084ed63" as pattern ["colors@~1.1.2","colors@^1.1.2"

]. This could result in a non deterministic behavior, skipping.
warning Pattern ["object-assign@latest"] is trying to unpack in the same destination "C:\users\...\AppData\Local\Yarn\cache\v1\npm-object-assign-4.1.1-2109adc7965887cfc05cbbd442cac8bfbb360863" as pattern ["object-assign@^4

.0.1","object-assign@^4.1.0","object-assign@^4.1.0","object-assign@^4.1.1","object-assign@^4"]. This could result in a non deterministic behavior, skipping.
warning Pattern ["send@latest"] is trying to unpack in the same destination "C:\users\...\AppData\Local\Yarn\cache\v1\npm-send-0.16.1-a70e1ca21d1382c11d0d9f6231deb281080d7ab3" as pattern ["[email protected]"]. This could result in a non deterministic behavior, skipping.
info [email protected]: The platform "win32" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
[1/2] ⠄ uglifyjs-webpack-plugin
[2/2] ⠄ coffee-script
[-/2] ⠄ waiting...
[-/2] ⠄ waiting...
error C:\users...\AppData\Local\Yarn\config\global\node_modules\csextends\node_modules\coffee-script: Command failed.
Exit code: 1
Command: node --eval 'if (require("./package.json").name === "coffee-script") { var red, yellow, cyan, reset; red = yellow = cyan = reset = ""; if (!process.env.NODE_DISABLE_COLORS) { red = "\x1b[31m"; yellow = "\x1b[33m"; cyan = "\x1b[36m"

; reset = "\x1b[0m"; } console.warn(red + "CoffeeScript has moved!" + reset + " Please update references to " + yellow + ""coffee-script"" + reset + " to use " + yellow + ""coffeescript"" + reset + " (no hyphen) instead."); console.warn

("Also, a new major version has been released under the " + yellow + "coffeescript" + reset + " name on NPM. This new release targets modern JavaScript, with minimal breaking changes. Learn more at " + cyan + "http://coffeescript.org" + res

et + "."); console.warn(""); }'
Arguments:
Directory: C:\users...\AppData\Local\Yarn\config\global\node_modules\csextends\node_modules\coffee-script
Output:
eval:1
'if
^^^

SyntaxError: Invalid or unexpected token
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Object. (eval-wrapper:6:22)
at Module._compile (module.js:635:30)`

Operating System, Node.js, npm, compodoc version(s)

OS: Windows 10 Enterprise N 2016 LTSB
Node: 8.9.1
npm: 5.4.2
yarn: 1.3.2

Compodoc installed globally or locally ?

Trying both global and local installs, neither work

@karloscode
Copy link

Same issue here!!

@felipebri23
Copy link

I have the same issue

@vogloblinsky
Copy link
Contributor

@karloscode @felipebri23
Can i have ?
Node, npm, OS versions
Thanks

@vogloblinsky vogloblinsky changed the title Error when installing: SyntaxError: Invalid or unexpected token [BUG] Error when installing: SyntaxError: Invalid or unexpected token Dec 2, 2017
@KenVanGilbergen
Copy link

You can work around the issue by changing coffee-script to coffeescript in the package.json

@karloscode
Copy link

karloscode commented Dec 18, 2017

We can use in local development changing the package.json but not work with CI

@vogloblinsky
Copy link
Contributor

I don't use directly coffeescript inside compodoc.
Which dependency is related to that ? @KenVanGilbergen ?

@vogloblinsky vogloblinsky added this to the 1.0.7 milestone Dec 18, 2017
@karloscode
Copy link

karloscode commented Dec 18, 2017

Yes , is in shelljs

https://github.com/shelljs/shelljs/blob/master/package.json

I think this is a unused dependency.
captura

@vogloblinsky
Copy link
Contributor

Yes it is a dev-dependency inside shelljs.

Here is the main issue inside coffeescript : jashkenas/coffeescript#4805

No clear solution.

I will try to find a cleaner alternative.

@vogloblinsky
Copy link
Contributor

After searching inside codebase, shelljs seems to not be used anymore. I remove the dependency.

Everyting will be fine with next release.

@lock
Copy link

lock bot commented Sep 30, 2019

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem. Why locking ? Having issues with the most up-to-date context.

@lock lock bot locked as resolved and limited conversation to collaborators Sep 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants