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

Module not found: Error: Can't resolve 'fs' in #28

Closed
alexander171294 opened this issue Jun 27, 2018 · 1 comment
Closed

Module not found: Error: Can't resolve 'fs' in #28

alexander171294 opened this issue Jun 27, 2018 · 1 comment

Comments

@alexander171294
Copy link

alexander171294 commented Jun 27, 2018

Hi, im trying to serve my Angular6/nativescript-schematics shared code, using this:

ng serve

(For publish in localhost:4200), then the first code work fine, but i add a stompjs/websockets client and it breaks,

This is the error:

ERROR in ./node_modules/debug/src/node.js
Module not found: Error: Can't resolve 'fs' in '/Users/alexander.eberle/git/web-poker/frontend/pokerclient/node_modules/debug/src'
ERROR in ./node_modules/eventsource/lib/eventsource.js
Module not found: Error: Can't resolve 'http' in '/Users/alexander.eberle/git/web-poker/frontend/pokerclient/node_modules/eventsource/lib'
ERROR in ./node_modules/eventsource/lib/eventsource.js
Module not found: Error: Can't resolve 'https' in '/Users/alexander.eberle/git/web-poker/frontend/pokerclient/node_modules/eventsource/lib'
ERROR in ./node_modules/debug/src/node.js
Module not found: Error: Can't resolve 'tty' in '/Users/alexander.eberle/git/web-poker/frontend/pokerclient/node_modules/debug/src'
ERROR in ./node_modules/stompjs/lib/stomp-node.js
Module not found: Error: Can't resolve 'websocket' in '/Users/alexander.eberle/git/web-poker/frontend/pokerclient/node_modules/stompjs/lib'

i tryed the same configuration in a clean angular project (without nativescript-schematics) and work fine, but in shared version isn't work.

I understand if you say me thats not work in the ios / android version. it's fine (because I need a specific code for these platforms), but on the web version it should work.

Any ideas?

Thanks, and sorry for my bad english, i only speak spanish :P

Edit:

Im using last version of nativescript and angular, and check the dependencies, you can check the code here:
https://github.com/alexander171294/web-poker/tree/master/frontend/pokerclient

Thanks!

@sebawita
Copy link
Contributor

sebawita commented Jul 4, 2018

hi @alexander171294,

sorry for the late reply. It was my mistake in the schematic, that added {N} paths to tsconfig.json.

A quick fix is to update tsconfig.json to:

{
  "compileOnSave": false,
  "compilerOptions": {
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "target": "es5",
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2017",
      "dom"
    ]
  }
}

That should do the trick.

I am currently in the process of updating the schematics. Tomorrow the ng new schematic should be working correctly.

@sebawita sebawita closed this as completed Jul 4, 2018
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

2 participants