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

Tutorial doesn't run on Node 10.15.3 / Windows #45

Closed
mathieucaroff opened this issue Mar 21, 2020 · 2 comments
Closed

Tutorial doesn't run on Node 10.15.3 / Windows #45

mathieucaroff opened this issue Mar 21, 2020 · 2 comments
Assignees
Labels

Comments

@mathieucaroff
Copy link

The tutorial completely fails form me with Node 10.15.3, on Windows.

Steps to reproduce

I have:

  1. (Step 0) Cloned the repository
  2. (Step 0) Install dependencies with npm install
  3. (Step 1) Added intern to the repository with npm npm install --save-dev intern
  4. (Step 1) Added the types array to tsconfig.json
  5. (Step 2) Copied the provided config to intern.json
  6. (Step 2) Run npm test

Here's the output I get:

PS C:\ox\learn\intern-tutorial> npm install --save-dev intern
npm WARN ts-node@8.7.0 requires a peer of typescript@>=2.7 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.3 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

+ intern@4.8.0
added 212 packages from 248 contributors and audited 962 packages in 21.552s
found 40 vulnerabilities (14 low, 10 moderate, 16 high)
  run `npm audit fix` to fix them, or `npm audit` for details
PS C:\ox\learn\intern-tutorial>
PS C:\ox\learn\intern-tutorial>
PS C:\ox\learn\intern-tutorial>
PS C:\ox\learn\intern-tutorial>
PS C:\ox\learn\intern-tutorial>
PS C:\ox\learn\intern-tutorial>
PS C:\ox\learn\intern-tutorial> node --version
v10.15.3
PS C:\ox\learn\intern-tutorial>
PS C:\ox\learn\intern-tutorial>
PS C:\ox\learn\intern-tutorial>
PS C:\ox\learn\intern-tutorial>
PS C:\ox\learn\intern-tutorial>
PS C:\ox\learn\intern-tutorial> npm test

> intern-tutorial@4.0.0-alpha.12 pretest C:\ox\learn\intern-tutorial
> npm run build


> intern-tutorial@4.0.0-alpha.12 build C:\ox\learn\intern-tutorial
> concurrently "npm run compile" "npm run copy"

[0] 
[0] > intern-tutorial@4.0.0-alpha.12 compile C:\ox\learn\intern-tutorial
[0] > tsc -p .
[0]
[1]
[1] > intern-tutorial@4.0.0-alpha.12 copy C:\ox\learn\intern-tutorial
[1] > cpx "src/**/*.{js,html,css}" _dist/src
[1]
[1] npm run copy exited with code 0
[0] node_modules/@types/node/events.d.ts(21,46): error TS1005: '=' expected.
[0] node_modules/@types/node/events.d.ts(32,36): error TS1005: '=' expected.
[0] node_modules/@types/node/repl.d.ts(361,36): error TS1005: '=' expected.
[0] node_modules/@types/node/repl.d.ts(367,36): error TS1005: '=' expected.
[0] node_modules/@types/node/util.d.ts(26,30): error TS1005: '=' expected.
[0] node_modules/@types/node/util.d.ts(121,30): error TS1005: '=' expected.
[0] npm ERR! code ELIFECYCLE
[0] npm ERR! errno 2
[0] npm ERR! intern-tutorial@4.0.0-alpha.12 compile: `tsc -p .`
[0] npm ERR! Exit status 2
[0] npm ERR!
[0] npm ERR! Failed at the intern-tutorial@4.0.0-alpha.12 compile script.
[0] npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
[0] 
npm ERR! A complete log of this run can be found in:
[0] npm ERR!     C:\Users\feref\AppData\Roaming\npm-cache\_logs\2020-03-21T11_27_49_495Z-debug.log
[0] npm run compile exited with code 2
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! intern-tutorial@4.0.0-alpha.12 build: `concurrently "npm run compile" "npm run copy"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the intern-tutorial@4.0.0-alpha.12 build 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!     C:\Users\feref\AppData\Roaming\npm-cache\_logs\2020-03-21T11_27_49_531Z-debug.log
npm ERR! Test failed.  See above for more details.
PS C:\ox\learn\intern-tutorial>

Expected behavior

The tutorial advertises intern should output:

No unit test coverage for node
node: 0 passed, 0 failed

Current behavior

Intern outputs the above error message, and nothing about any test.

Possible solution

The relevant part of the error message probably is the following:

[0] node_modules/@types/node/events.d.ts(21,46): error TS1005: '=' expected.
[0] node_modules/@types/node/events.d.ts(32,36): error TS1005: '=' expected.
[0] node_modules/@types/node/repl.d.ts(361,36): error TS1005: '=' expected.
[0] node_modules/@types/node/repl.d.ts(367,36): error TS1005: '=' expected.
[0] node_modules/@types/node/util.d.ts(26,30): error TS1005: '=' expected.
[0] node_modules/@types/node/util.d.ts(121,30): error TS1005: '=' expected.
[0] npm ERR! code ELIFECYCLE
[0] npm ERR! errno 2
[0] npm ERR! intern-tutorial@4.0.0-alpha.12 compile: `tsc -p .`
[0] npm ERR! Exit status 2
[0] npm ERR!
[0] npm ERR! Failed at the intern-tutorial@4.0.0-alpha.12 compile script.

so it looks like the issue is with tsc, and indeed running node node_modules/typescript/bin/tsc -p . manually, or running npm run compile produces the same 6 first lines (without the [0] prefix).

Furthermore, running npm run compile on a clean repository clone, after npm install, but before npm install --save-dev intern doesn't produce any error. So I suspect this is of compatibility between the tutorial version and the current intern version.

It turns out that the install log of npm install --save-dev intern contains the following line:

npm WARN ts-node@8.7.0 requires a peer of typescript@>=2.7 but none is installed. You must install peer dependencies yourself.

The problem likely comes from the above missing peer dependency.

Environment

Intern version: 4.8.0
Node version: 10.15.3
NPM version: 6.4.1
Browser version: N/A

@mathieucaroff
Copy link
Author

I tried using an intern@3 (intern@3.4.6) but to no avail.

I tried upgrading the typescript version (typescript@3.8.3).

Upgrading the typescript version worked.

@jason0x43 jason0x43 added the bug label Mar 23, 2020
@jason0x43 jason0x43 self-assigned this Mar 23, 2020
@jason0x43
Copy link
Member

Thanks for catching this! The problem is that Intern includes modern Node typings, and these use some TS features that aren't available in the version of TS the tutorial is currently using.

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

No branches or pull requests

2 participants