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

Error: Cannot find module "entities/maps/entities.json" #135

Closed
rewmike opened this issue Apr 26, 2016 · 12 comments
Closed

Error: Cannot find module "entities/maps/entities.json" #135

rewmike opened this issue Apr 26, 2016 · 12 comments

Comments

@rewmike
Copy link

rewmike commented Apr 26, 2016

Latest 2.2.1 release throws error in console:

Error: Cannot find module "entities/maps/entities.json"

Release 2.2.0 works fine, related to changes in #131.

I am running Node v5.0.0 and npm v3.3.6.

@mik01aj
Copy link
Collaborator

mik01aj commented Apr 27, 2016

My fault (see this commit).

But on the other hand, I don't understand why that /node_modules\/entities\/.*\.json$/ regex doesn't match that JSON module. Maybe we should replace it with /entities\/maps\/.*\.json$/?

@sapegin
Copy link
Member

sapegin commented Apr 27, 2016

Works fine for me: Node 5.10.1, npm 3.8.3. Could you try to remove node_modules folder and reinstall all dependencies?

@rewmike
Copy link
Author

rewmike commented Apr 27, 2016

Same issue if starting fresh, running on Windows 7.

@rewmike
Copy link
Author

rewmike commented Apr 27, 2016

ERROR in ./~/entities/maps/entities.json
Module parse failed: *****\node_modules\entities\maps\entities.json Unexpected token (1:9)
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected token (1:9)
at Parser.pp.raise (*****\node_modules\webpack\node_modules\acorn\dist\acorn.js:920:13)
at Parser.pp.unexpected (*****\node_modules\webpack\node_modules\acorn\dist\acorn.js:1483:8)
at Parser.pp.semicolon (*****\node_modules\webpack\node_modules\acorn\dist\acorn.js:1462:73)
at Parser.pp.parseExpressionStatement (*****\node_modules\webpack\node_modules\acorn\dist\acorn.js:1976:8)
at Parser.pp.parseStatement (*****\node_modules\webpack\node_modules\acorn\dist\acorn.js:1754:188)
at Parser.pp.parseBlock (*****\node_modules\webpack\node_modules\acorn\dist\acorn.js:1991:21)
at Parser.pp.parseStatement (*****\node_modules\webpack\node_modules\acorn\dist\acorn.js:1735:19)
at Parser.pp.parseTopLevel (*****\node_modules\webpack\node_modules\acorn\dist\acorn.js:1648:21)
at Parser.parse (*****\node_modules\webpack\node_modules\acorn\dist\acorn.js:1616:17)
at Object.parse (*****\node_modules\webpack\node_modules\acorn\dist\acorn.js:882:44)
at Parser.parse (*****\node_modules\webpack\lib\Parser.js:902:15)
at DependenciesBlock.<anonymous> (*****\node_modules\webpack\lib\NormalModule.js:104:16)
at DependenciesBlock.onModuleBuild (*****\node_modules\webpack-core\lib\NormalModuleMixin.js:310:10)
at nextLoader (*****\node_modules\webpack-core\lib\NormalModuleMixin.js:275:25)
at *****\node_modules\webpack-core\lib\NormalModuleMixin.js:259:5
at Storage.finished (*****\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:38:16)
@ ./~/markdown-react-js/~/markdown-it/lib/common/entities.js 6:17-55
Child html-webpack-plugin for "index.html":

@mik01aj
Copy link
Collaborator

mik01aj commented Apr 28, 2016

Hmmm. From https://webpack.github.io/docs/troubleshooting.html#windows-paths:

Windows paths

webpack expects absolute paths for many config options. __dirname + "/app/folder" is wrong, because windows uses \ as path separator. This breaks some stuff. Use the correct separators. I.e. path.resolve(__dirname, "app/folder") or path.join(__dirname, "app", "folder").

So shall the regex be new RegExp(path.join('node_modules', 'entities', '.*\\.json$').replace('\\', '\\\\'))?... Ugly. 😦

@sapegin
Copy link
Member

sapegin commented Apr 28, 2016

Ugly as Windows ;-( Maybe there’s some npm module to do that in cross-platform way?

@sapegin
Copy link
Member

sapegin commented Apr 28, 2016

I think we can use _.escapeRegExp here.

@mik01aj
Copy link
Collaborator

mik01aj commented Apr 28, 2016

or we could use /[/\\]/ regex to match any path separator. So it would be: /node_modules[/\\]entities[/\\].*\.json$/. Still ugly.

@sapegin
Copy link
Member

sapegin commented Apr 29, 2016

Could anyone with Windows try this solutions and send a pull request if it works?

@mdhgriffiths
Copy link
Contributor

Works for me!

@tomnattle
Copy link

remove node_modules, run yarn

@jonathasborges1
Copy link

Remove node_modules e run npm install @angular/cli

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

No branches or pull requests

6 participants