Can not find module "."
See original GitHub issueI 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:
Issue Analytics
- State:
- Created 7 years ago
- Comments:25 (11 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
“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)Yes, I fixed it in 2.4.12 so the lest should work with the Webpack