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.

Can not find module "."

See original GitHub issue

I am using the following libraries:

Angular 2.0.1
Angular-CLI 1.0.0-Beta.16 (using webpack)
linq-es2015 2.4.1
TypeScript 2.0.3

With npm I did:

npm install linq-es2015 
npm install @types/linq-es2015 

I want to import your linq library in MyComponent.ts:

import * as Enumerable from 'linq-es2015';

In the angularcli configuration file I modify the scripts array:

"scripts": ["../node_modules/linq-es2015/dist/linq.js"],

Then I run my application and in the browser console I get that error:

Can not find module "." in your linq.js. line 16

The first thing I realized is that in my project under node_modules/@types/ there exist no linq-es2015 folder at all.

But I do not think thats the problem why I get that error during runtime.

I have still added a screenshot from chrome browser:

image

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:25 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
Vito2102commented, Oct 17, 2016

“module”: “commonjs” have to be set in source code of linq-es2015 before build.

If you want quick fix, you can change linq.js (and the same way other js files) in lib folder:

(function (factory) { if (typeof module === 'object' && typeof module.exports === 'object') { var v = factory(exports); if (v !== undefined) module.exports = v; } else if (typeof define === 'function' && define.amd) { define(["require", "exports", "./generators", "./utilities", "./iterators"], factory); } })(function (exports) { (remove require from function parameters)

0reactions
ENikScommented, Oct 23, 2016

Yes, I fixed it in 2.4.12 so the lest should work with the Webpack

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I resolve "Cannot find module" error using Node.js?
This happens when a first npm install has crashed for some reason (SIGINT of npm), or that the delay was too long, or...
Read more >
cannot find module [Node npm Error Solved] - freeCodeCamp
How to Fix the "cannot find module" Error · delete the node modules folder by running rm -rf node_modules · delete package.lock.json file...
Read more >
How to resolve "Cannot find module" error in Node - Sabe.io
The Cannot find module error is a common error that usually happens when dependencies are not installed. Once you install your dependencies and ......
Read more >
Cannot find module 'X' error in Node.js | bobbyhadz
To solve the "Cannot find module" error in Node.js, make sure to install the package from the error message if it's a third-party...
Read more >
How to resolve can't find module error in Node.js - Reactgo
To fix Cannot find module errors, install the modules properly by running a npm install command in the appropriate directory as your project's ......
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