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

Uncaught Error: Cannot find module "tslib" - Running self tests #929

Closed
gitgrimbo opened this issue Jun 26, 2018 · 8 comments
Closed

Uncaught Error: Cannot find module "tslib" - Running self tests #929

gitgrimbo opened this issue Jun 26, 2018 · 8 comments
Labels
bug Something that's not working as intended

Comments

@gitgrimbo
Copy link
Contributor

To run the self tests on Window, I had to install cross-env and use the following test script:

"test": "cross-env NODE_PATH=_build node _tests/src/bin/intern.js"

Expected behavior

Self tests run.

Current behavior

This page:

http://localhost:9000/__intern/browser/remote.html?basePath=%2F&runInSync&serverUrl=http%3A%2F%2Flocalhost%3A9000%2F&sessionId=8c18cc42a59ebb4441c4586c8d0b2e1a&socketPort=9001

is blank, and outputs this error in the console:

Uncaught Error: Cannot find module "tslib".
    at webpackEmptyContext (providers_sync:2)
    at eval (xhr.js:15)
    at eval (xhr.js:3)
    at eval (xhr.js:12)
    at Object../node_modules/@dojo/core/request/providers/xhr.js (remote.js:258)
    at __webpack_require__ (remote.js:20)
    at eval (Browser.ts:5)
    at Object../src/lib/executors/Browser.ts (remote.js:1326)
    at __webpack_require__ (remote.js:20)
    at eval (remote.ts:4)

Possible solution

Steps to reproduce (for bugs)

Environment

Intern version: 4.2.0
Node version: 10.3.0
NPM version: 6.1.0
Browser version: 67.0.3396.87 (Official Build) (64-bit)

Additional information

@gitgrimbo
Copy link
Contributor Author

In @dojo/core/request/providers/xhr.js:

image

In some error handler when trying to require("tslib"):

image

@gitgrimbo
Copy link
Contributor Author

Tried a clean build in VirtualBox/Ubuntu and works.

Get Critical dependency: require function is used in a way in which dependencies cannot be statically extracted warnings in a Windows build - I don't see this in Ubuntu:

Paul@Ryzen5 MINGW64 /d/dev/git_repos/intern/intern (issue-927)
$ npm run clean && npm run build

> intern@4.3.0-pre clean D:\dev\git_repos\intern\intern
> intern-dev-clean

2:12:30 PM - Removing _build
2:12:30 PM - Removing _tests
2:12:30 PM - Removing _examples
2:12:30 PM - Done cleaning

> intern@4.3.0-pre build D:\dev\git_repos\intern\intern
> intern-dev-clean && concurrently intern-dev-build intern-dev-api

2:12:31 PM - Removing _build
2:12:31 PM - Removing _tests
2:12:31 PM - Removing _examples
2:12:31 PM - Done cleaning
[0] 2:12:32 PM - Copying src/browser/remote.html to _build
[0] 2:12:32 PM - Copying src/favicon.png to _build
[0] 2:12:32 PM - Copying src/index.html to _build
[0] 2:12:32 PM - Copying src/lib/reporters/html/html.styl to _build
[0] 2:12:32 PM - Copying src/lib/reporters/html/variables.styl to _build
[0] 2:12:32 PM - Copying src/loaders/globals.d.ts to _build
[0] 2:12:32 PM - Copying tests/globals.d.ts to _tests
[0] 2:12:32 PM - Copying tests/selftest.local.intern.js to _tests
[0] 2:12:32 PM - Copying tests/support/mocking.d.ts to _tests
[0] 2:12:32 PM - Copying tests/unit/data/lib/executors/intern.js to _tests
[0] 2:12:32 PM - Copying tests/unit/data/lib/reporters/JUnit/expected.xml to _tests
[0] 2:12:32 PM - Copying tests/unit/data/lib/util/bar.js to _tests
[0] 2:12:32 PM - Copying tests/unit/data/lib/util/baz.js to _tests
[0] 2:12:32 PM - Copying tests/unit/data/lib/util/foo.js to _tests
[0] 2:12:32 PM - Copying src/browser/remote.html to _tests
[0] 2:12:32 PM - Copying src/favicon.png to _tests
[0] 2:12:32 PM - Copying src/index.html to _tests
[0] 2:12:32 PM - Copying src/lib/reporters/html/html.styl to _tests
[0] 2:12:32 PM - Copying src/lib/reporters/html/variables.styl to _tests
[0] 2:12:32 PM - Copying src/loaders/globals.d.ts to _tests
[0] 2:12:32 PM - Copying package.json to _build\src
[0] 2:12:32 PM - Copying README.md to _build\src
[0] 2:12:32 PM - Copying LICENSE to _build\src
[0] 2:12:32 PM - Linting .
[1] 2:12:32 PM - Generating API data
[0] 2:12:35 PM - Compiling .
[1] 2:12:38 PM - Scrubbing file paths
[1] 2:12:38 PM - Wrote API data to docs\api.json
[1] intern-dev-api exited with code 0
[0] 2:12:41 PM - Linting tests
[0] 2:12:45 PM - Compiling tests
[0] 2:12:53 PM - Linting tests/examples
[0] 2:12:55 PM - Compiling tests/examples
[0] 2:13:13 PM - [webpack]     Time: 14303ms
[0] 2:13:13 PM - [webpack]     Built at: 06/26/2018 2:13:13 PM
[0] 2:13:13 PM - [webpack]     Entrypoint intern [big] = intern.js
[0] 2:13:13 PM - [webpack]     Entrypoint remote [big] = remote.js
[0] 2:13:13 PM - [webpack]     Entrypoint config [big] = config.js
[0] 2:13:13 PM - [webpack]     WARNING in ./node_modules/@dojo/shim/object.js
[0] 2:13:13 PM - [webpack]     3:24-31 Critical dependency: require function is used in a way in which dependencies cannot be statically extracted
[0] 2:13:13 PM - [webpack]      @ ./node_modules/@dojo/shim/object.js
[0] 2:13:13 PM - [webpack]      @ ./node_modules/@dojo/core/lang.js
[0] 2:13:13 PM - [webpack]      @ ./src/lib/common/util.ts
[0] 2:13:13 PM - [webpack]      @ ./src/browser/remote.ts
[0] 2:13:13 PM - [webpack]     WARNING in ./node_modules/@dojo/shim/global.js
[0] 2:13:13 PM - [webpack]     3:24-31 Critical dependency: require function is used in a way in which dependencies cannot be statically extracted
[0] 2:13:13 PM - [webpack]      @ ./node_modules/@dojo/shim/global.js
[0] 2:13:13 PM - [webpack]      @ ./src/browser/intern.ts
[0] 2:13:13 PM - [webpack]     WARNING in ./node_modules/@dojo/core/lang.js
[0] 2:13:13 PM - [webpack]     3:24-31 Critical dependency: require function is used in a way in which dependencies cannot be statically extracted
[0] 2:13:13 PM - [webpack]      @ ./node_modules/@dojo/core/lang.js
[0] 2:13:13 PM - [webpack]      @ ./src/lib/common/util.ts
[0] 2:13:13 PM - [webpack]      @ ./src/browser/remote.ts
...

@jason0x43
Copy link
Member

Did you verify that tslib was present? It's a top-level dependency of intern, so it should be available in node_modules. I've seen a couple of cases recently with npm 5.x where running npm install on packages (intern and others) resulted in a node_modules that didn't actually contain all the dependencies.

@gitgrimbo
Copy link
Contributor Author

gitgrimbo commented Jul 3, 2018

  • deleted node_modules
  • fetched upstream master branch
  • ran npm i
  • installed cross-env
  • changed script to "start": "cross-env NODE_PATH=_build node _tests/src/bin/intern.js serveOnly"
  • browse to http://localhost:9000/__intern/ in Chrome

Error is:

VM52 providers_sync:4 Uncaught Error: Cannot find module "tslib".
    at webpackEmptyContext (VM52 providers_sync:2)
    at eval (VM51 xhr.js:15)
    at eval (VM51 xhr.js:3)
    at eval (VM51 xhr.js:12)
    at Object../node_modules/@dojo/core/request/providers/xhr.js (intern.js:258)
    at __webpack_require__ (intern.js:20)
    at eval (Browser.ts:5)
    at Object../src/lib/executors/Browser.ts (intern.js:1278)
    at __webpack_require__ (intern.js:20)
    at eval (intern.ts:4)
providers_sync:4 Uncaught Error: Cannot find module "tslib".
    at webpackEmptyContext (VM52 providers_sync:2)
    at eval (VM51 xhr.js:15)
    at eval (VM51 xhr.js:3)
    at eval (VM51 xhr.js:12)
    at Object../node_modules/@dojo/core/request/providers/xhr.js (config.js:247)
    at __webpack_require__ (config.js:20)
    at eval (util.ts:3)
    at Object../src/lib/browser/util.ts (config.js:525)
    at __webpack_require__ (config.js:20)
    at eval (config.ts:4)
(index):26 Uncaught ReferenceError: internConfig is not defined
    at (index):26

index:26 is:

		<!-- Load intern code in the body because Html reporter needs a DOM -->
		<script src="browser/intern.js"></script>
		<script src="browser/config.js"></script>
		<script>
-->		internConfig.getConfig()
			.then(function (result) {

There are no network errors (404s and the like), only this console error.

@jason0x43 jason0x43 added the bug Something that's not working as intended label Jul 3, 2018
@jason0x43
Copy link
Member

I've been able to reproduce this. Setting NODE_PATH doesn't affect it one way or the other. The issue seems to be that the test server can't find modules on Windows.

bryanforbes added a commit to bryanforbes/intern that referenced this issue Jul 3, 2018
jason0x43 pushed a commit that referenced this issue Jul 3, 2018
@gitgrimbo
Copy link
Contributor Author

gitgrimbo commented Jul 6, 2018

Hi. I've

  • checked out the 4.2.2 release
  • done a clean install of node_modules
  • run npm start

and am still seeing the same error at http://localhost:9000/__intern/.

@jason0x43
Copy link
Member

I tried this on a Windows 10 system with a couple different versions of node and npm, and the tests are loading and running properly:

  1. Made a new clone of Intern
  2. Checked out 4.2.2
  3. npm install
  4. npm run build
  5. npm start
  6. Open http://localhost:900/__intern/

Did you verify that tslib is present in your node_modules?

@gitgrimbo
Copy link
Contributor Author

Running the npm run build step seemed to be what I missed out, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something that's not working as intended
Projects
None yet
Development

No branches or pull requests

2 participants