mzgoddard / hard-source-webpack-plugin

https://www.npmjs.com/package/hard-source-webpack-plugin
ISC License
2.71k stars 160 forks source link

[ERROR] (node:13902) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: ENOTDIR: not a directory, stat 'node_modules/.cache/hard-source/.DS_Store/stamp' #456

Open agrawalrahul0305 opened 6 years ago

agrawalrahul0305 commented 6 years ago

Expected Behavior

Further builds must read from the existing cache

Please describe what should happen When i build using the plugin i get unhandled promise error. Though the cache is created under /node_modules/.cache/hard-source/f96aad28c603828e2fe40cbd66df973e3760e842ef7f891875dac006be716da5 , but in the error below 'node_modules/.cache/hard-source/.DS_Store/stamp' not sure why it is reading from .DS_Store/stamp

Actual Behavior

[ERROR] (node:13902) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: ENOTDIR: not a directory, stat 'node_modules/.cache/hard-source/.DS_Store/stamp'. As a result of this the bundles are not created Describe what actually happens

Is an error being thrown?

[ERROR] (node:13902) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: ENOTDIR: not a directory, stat 'node_modules/.cache/hard-source/.DS_Store/stamp' [ERROR] (node:13902) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Include a stack trace if an error is occuring

Steps to Reproduce

  • Steps to create a minimal reproduction or a link to a repository containing the same
  • Any other information you find helpful reproducing an issue

Operating System, Node, and NPM dependency versions

Mac OS 10.12.6
Node 8.9.4

"devDependencies": {
 "async": "^0.9.0",
    "autoprefixer": "^7.1.2",
    "axios": "^0.16.2",
    "babel-core": "^6.22.1",
    "babel-eslint": "^8.2.1",
    "babel-helper-vue-jsx-merge-props": "^2.0.3",
    "babel-loader": "^7.1.1",
    "babel-plugin-dynamic-import-node": "^1.2.0",
    "babel-plugin-syntax-jsx": "^6.18.0",
    "babel-plugin-transform-es2015-modules-commonjs": "^6.26.0",
    "babel-plugin-transform-runtime": "^6.22.0",
    "babel-plugin-transform-vue-jsx": "^3.5.0",
    "babel-polyfill": "^6.26.0",
    "babel-preset-env": "^1.3.2",
    "babel-preset-stage-2": "^6.22.0",
    "babel-register": "^6.22.0",
    "chalk": "^2.0.1",
    "chromedriver": "^2.27.2",
    "copy-webpack-plugin": "^4.0.1",
    "cross-spawn": "^5.0.1",
    "css-loader": "^0.28.0",
    "eslint": "^4.18.2",
    "eslint-config-prettier": "^2.9.0",
    "eslint-friendly-formatter": "^3.0.0",
    "eslint-loader": "^1.7.1",
    "eslint-plugin-prettier": "^2.6.0",
    "eslint-plugin-vue": "^4.3.0",
    "extract-text-webpack-plugin": "^3.0.0",
    "file-loader": "^1.1.4",
    "friendly-errors-webpack-plugin": "^1.6.1",
    "fs-extra": "^0.17.0",
    "gulp": "^3.9.1",
    "gulp-rename": "^1.2.0",
    "gulp-sass": "^2.1.0-beta",
    "html-webpack-plugin": "^2.30.1",
    "nightwatch": "^0.9.12",
    "node-notifier": "^5.1.2",
    "node-sass": "4.7.2",
    "optimize-css-assets-webpack-plugin": "^3.2.0",
    "ora": "^1.2.0",
    "portfinder": "^1.0.13",
    "postcss-import": "^11.0.0",
    "postcss-loader": "^2.0.8",
    "postcss-url": "^7.2.1",
    "prettier": "1.11.1",
    "rimraf": "^2.6.0",
    "sass-loader": "^6.0.6",
    "selenium-server": "^3.0.1",
    "semver": "^5.3.0",
    "shelljs": "^0.7.6",
    "style-loader": "^0.20.2",
    "hard-source-webpack-plugin": "^0.11.1",
    "uglifyjs-webpack-plugin": "^1.1.1",
    "speed-measure-webpack-plugin": "^1.2.3",
    "url-loader": "^0.5.8",
    "vue-loader": "^13.3.0",
    "vue-style-loader": "^3.0.1",
    "vue-template-compiler": "^2.5.2",
    "webpack": "^3.6.0",
    "webpack-bundle-analyzer": "^2.9.0",
    "webpack-dev-server": "^2.9.6",
    "webpack-merge": "^4.1.0"
},
"dependencies": {
    "async": "^0.9.2",
    "es6-promise": "^4.2.4",
    "lodash": "^4.17.5",
    "vue": "^2.5.2",
    "vue-lodash": "^1.0.4",
    "vue-moment": "^4.0.0",
    "vue-router": "^3.0.1",
    "vue-the-mask": "^0.11.1"
}
AndresMaca commented 6 years ago

Same error, someone? with osx mojave Ok, buddy just execute: rm -rf _your_app_folderpath/node_modules/.cache/hard-source/.DS_Store/stamp in my case: rm -rf /Users/MyUser/Escritorio/Blockchain2/embarkEx/TokenFactory/node_modules/.cache/hard-source/.DS_Store

v-pukman commented 6 years ago

Same error, someone? with osx mojave Ok, buddy just execute: rm -rf _your_app_folderpath/node_modules/.cache/hard-source/.DS_Store/stamp in my case: rm -rf /Users/MyUser/Escritorio/Blockchain2/embarkEx/TokenFactory/node_modules/.cache/hard-source/.DS_Store

That will help only the first time. If webpack is watching the error will be raised again.

This solution will fix the problem:

Delete this file:

rm /Users/MyUser/Escritorio/Blockchain2/embarkEx/TokenFactory/node_modules/.cache/hard-source/.DS_Store

Ignore .DS_Store files in webpack.config

plugins = []
plugins.push(new HardSourceWebpackPlugin.ExcludeModulePlugin([
  {
    test: /.*\.DS_Store/
  }
])) 
module.exports =
 plugins: plugins

Restart webpack

./node_modules/webpack/bin/webpack.js --watch --progress --colors
waterlink commented 5 years ago

@v-pukman The proposed solution with ExcludeModulePlugin doesn’t work for me, for some reason…

The file node_modules/.cache/hard-source/.DS_Store still appears, and the webpack watch gets stuck indefinitely.

This is the code:

plugins: [
    new HardSourceWebpackPlugin(),
    new HardSourceWebpackPlugin.ExcludeModulePlugin([
      {
        test: /.*\.DS_Store/
      }
    ]),
    new webpack.HotModuleReplacementPlugin(),
    ...
],

And this is the error:

ENOTDIR: not a directory, stat 'node_modules/.cache/hard-source/.DS_Store/stamp'

Any ideas?

v-pukman commented 5 years ago

@waterlink did you remove .DS_Store or whole hard-source folder from .cache?

thorsent commented 4 years ago

I'm getting the same (similar) ENOTDIR error when setting a custom cacheDirectory on MacOS (Catalina).

Webpack Error. Error: ENOTDIR: not a directory, stat '/Users/thorsent/src/finsemble-mono/packages/seed/.webpack-file-cache/0487cb8e5ee23597045e440f0c5c6503.json.gz/stamp'

Overall relatively vanilla webpack configuration. Here is the plugin configuraton:

    new HardSourceWebpackPlugin({
        info: {
            level: "warn",
        },
        cacheDirectory: "../.webpack-file-cache/[confighash]",
    })

I've tried on both node 12.x and node 14.x. Both exhibit the same error.

I've tried adding the ExcludeModulePlugin but no luck:

    new HardSourceWebpackPlugin.ExcludeModulePlugin([
      {
        test: /.*\.webpack-file-cache/
      }
    ])
spock504 commented 4 years ago

delete the file folader 'node_modules/.cache/hard-source' and restart. It help for me.

lizongze commented 4 years ago

when I do 'open node_modules' and click into '.cache/hard-source', it works fine. But when I click into '.cache/hard-source/[hash]', the recompile emits the below error:

ℹ 「wdm」: Compiled with warnings.
ℹ 「wdm」: Compiling...
✖ 「wdm」: Error: ENOTDIR: not a directory, stat '/Users/leo/Documents/gitData/github/front-theory/apps/link/node_modules/.cache/hard-source/.DS_Store/stamp'