Node 'fs' issue



I installed fs in my app by using this commnad

npm install fs --save

and in my model take reference of fs like

import * as fs from ‘fs’;

error is:

Couild not fine module ‘fs’ imported from 'testapp/models/testmodel

how can i resolve this issue


Node is service-side javascript, so you shouldn’t use it in an Ember model (or any other Ember module).

Also Node uses CommenJS moduling, so import shouldn’t work anyway.


try this plug-in


ember-auto-import isn’t going to help with this, because fs is not something that can ever work directly from within a web browser. Ember apps run in web browsers, web browsers can’t manipulate the filesystem.

One thing you can do is use ember-electron to package your ember app into a desktop app, in which case you can use fs and everything else Node can do.