generator-fountain-webapp icon indicating copy to clipboard operation
generator-fountain-webapp copied to clipboard

webpack:dist not building

Open mde17 opened this issue 9 years ago • 8 comments

ERROR in ./~/npm/~/glob/~/fs.realpath/old.js Module not found: Error: Can't resolve 'fs' in in '/Users/user/code/webapp/node_modules/npm/node_modules/glob/node_modules/fs.realpath' @ ./~/npm/~/glob/~/fs.realpath/old.js 24:9-22 @ ./~/npm/~/glob/~/fs.realpath/index.js @ ./~/npm/~/glob/glob.js @ ./~/npm/~/rimraf/rimraf.js @ ./~/npm/lib/cache/caching-client.js @ ./~/npm/lib/npm.js @ multi vendor

mde17 avatar Sep 28 '16 09:09 mde17

Hi,

Can you provide more infos to reproduce your error for fastest resolution?

You can use our issue template. https://github.com/FountainJS/generator-fountain-webapp/blob/master/.github/issue_template.md

zckrs avatar Sep 28 '16 09:09 zckrs

@zckrs I think the steps to reproduce this are to use npm for package management, add some npm package to your project as a dependency, and then build the distribution.

I'm a webpack newbie trying to convert my existing project from the old gulp-angular-generator. Not sure how to configure webpack to find the things it needs from the dependencies and ignore the things it doesn't need.

For example 2 errors (from the 'spinkit' npm package, there are more...):

Module not found: Error: Can't resolve 'fs' in '/Users/sunild/code/socialie/suggester/node_modules/spinkit'
 @ ./~/spinkit/gulpfile.js 3:9-22
 @ multi vendor

ERROR in ./~/spinkit/gulpfile.js
Module not found: Error: Can't resolve 'gulp-autoprefixer' in '/Users/sunild/code/socialie/suggester/node_modules/spinkit'
 @ ./~/spinkit/gulpfile.js 6:19-47
 @ multi vendor

Configuration:

{
  "generator-fountain-angular1": {
    "version": "1.0.0-rc1",
    "props": {
      "framework": "angular1",
      "modules": "webpack",
      "js": "typescript",
      "ci": [],
      "css": "scss",
      "resolved": "/Users/sunild/n/lib/node_modules/generator-fountain-webapp/node_modules/generator-fountain-angular1/generators/app/index.js",
      "namespace": "fountain-angular1",
      "argv": {
        "remain": [],
        "cooked": [],
        "original": []
      },
      "sample": "hello",
      "router": "uirouter"
    }
  }
}

I also tried installing "spinkit" into a brand new project, same config as above but w/the TODO MVC scaffolding. It failed, same as above.

What is the preferred way of including/excluding files from npm dependencies?

sunild avatar Nov 16 '16 22:11 sunild

I have the same issue.

Description

Error Message & Stack Trace

[09:23:51] Loading /Users/calvin/dev/hospitalMap/gulp_tasks/browsersync.js
[09:23:52] Loading /Users/calvin/dev/hospitalMap/gulp_tasks/karma.js
[09:23:54] Loading /Users/calvin/dev/hospitalMap/gulp_tasks/misc.js
[09:23:55] Loading /Users/calvin/dev/hospitalMap/gulp_tasks/webpack.js
[09:23:56] Using gulpfile ~/dev/hospitalMap/gulpfile.js
[09:23:56] Starting 'build'...
[09:23:56] Starting 'other'...
[09:23:56] Starting 'webpack:dist'...
[09:24:01] Finished 'other' after 4.82 s
[09:24:24] Time: 27381ms
                         Asset     Size  Chunks       Chunk Names
vendor-794d775dfd6b685d2497.js  1.34 MB       0       vendor

ERROR in Entry module not found: Error: Can't resolve 'babel' in '/Users/calvin/dev/hospitalMap'

ERROR in ./~/mime/mime.js
Module not found: Error: Can't resolve 'fs' in '/Users/calvin/dev/hospitalMap/node_modules/mime'
 @ ./~/mime/mime.js 2:9-22
 @ ./~/url-loader/index.js
 @ multi vendor
Child html-webpack-plugin for "index.html":
         Asset    Size  Chunks       Chunk Names
    index.html  2.9 kB       0
[09:24:24] Finished 'webpack:dist' after 28 s
[09:24:24] Finished 'build' after 28 s

Config

{
  "generator-fountain-angular1": {
    "version": "1.0.0-rc1",
    "props": {
      "framework": "angular1",
      "modules": "webpack",
      "js": "babel",
      "ci": [],
      "css": "scss",
      "resolved": "/usr/local/lib/node_modules/generator-fountain-webapp/node_modules/generator-fountain-angular1/generators/app/index.js",
      "namespace": "fountain-angular1",
      "argv": {
        "remain": [],
        "cooked": [],
        "original": []
      },
      "sample": "hello",
      "router": "uirouter"
    }
  }
}

Environment

Node.js v7.2.1
darwin 16.1.0
yo 1.8.5
npm 3.10.10

spaceghostu avatar Dec 12 '16 07:12 spaceghostu

I also get the same error.

ERROR in ./~/mime/mime.js
Module not found: Error: Can't resolve 'fs' in '/home/linx/Development/html/8esc-angular/node_modules/mime'
 @ ./~/mime/mime.js 2:9-22
 @ ./~/url-loader/index.js
 @ multi vendor

I can get passed this error by adding the following into webpack-dist.conf.js

node: {
  fs: "empty"
},

However when I build and run the code, I get a readFileSync error...

Any update with this?

linx8 avatar Jan 30 '17 03:01 linx8

poke

sagaratyieldmo avatar Mar 10 '17 20:03 sagaratyieldmo

I solved this, see - http://stackoverflow.com/questions/38546141/how-to-browserify-node-fs-readfilesync-to-make-it-work-in-chrome-safari-ie/41991391#41991391

linx8 avatar Mar 12 '17 04:03 linx8

same error here...

marcodelu avatar May 09 '17 12:05 marcodelu

spent way too much time on this one, after hours i found the culprit line but don't understand the root cause yet:

in webpack-dist.conf the vendor chunk is packing every dependency in the package.json, not dev-dependency

entry: {
    app: `./${conf.path.src('index')}`
   // vendor: Object.keys(pkg.dependencies) <-- works without
  }

in my case the

browser: {
  ionicons: false
},

also stopped the error but i have no real clue whats the right way to deal with this

simonbuehler avatar Oct 25 '17 11:10 simonbuehler