Nargonath / cra-build-watch

A script for create-react-app that writes development builds to the disk
MIT License
136 stars 38 forks source link

Support for CRA 3.0.0? #32

Closed brymon68 closed 4 years ago

brymon68 commented 5 years ago

EDIT - I get the same error with react-scripts v2.1.8 I am guessing there is some dependency in my package.json your watch script doesnt like? Adding package.json as well:

{
        "name": "vast-ui-2",
        "version": "0.1.0",
        "private": true,
        "dependencies": {
                "@material-ui/core": "^3.9.3",
                "@material-ui/icons": "^3.0.2",
                "@material-ui/styles": "latest",
                "autoprefixer": "7.1.6",
                "awesome-debounce-promise": "^2.1.0",
                "axios": "^0.18.0",
                "babel-eslint": "^10.0.1",
                "case-sensitive-paths-webpack-plugin": "2.1.1",
                "classnames": "^2.2.6",
                "css-loader": "0.28.7",
                "date-fns": "^1.30.1",
                "debounce": "^1.2.0",
                "events": "latest",
                "fs-extra": "3.0.1",
                "history": "^4.9.0",
                "is-ip": "^3.0.0",
                "jquery": "^3.3.1",
                "notistack": "^0.4.3",
                "promise": "8.0.1",
                "prop-types": "^15.7.2",
                "react": "^16.8.6",
                "react-broadcast": "^0.6.1",
                "react-dev-utils": "^5.0.1",
                "react-dom": "^16.8.6",
                "react-frame": "latest",
                "react-json-view": "^1.19.1",
                "react-router-bootstrap": "latest",
                "react-router-dom": "^5.0.0",
                "react-scripts": "2.1.8",
                "react-swipeable-views": "^0.13.1",
                "react-table": "^6.9.2",
                "recompose": "^0.26.0",
                "resolve": "1.6.0",
                "style-loader": "0.19.0",
                "styled-components": "^4.2.0",
                "url-loader": "0.6.2"
        },
        "devDependencies": {
                "copy-webpack-plugin": "^4.6.0",
                "cra-build-watch": "^1.4.1",
                "prettier": "1.17.1",
                "react-dev-utils": "^7.0.1"
        },
        "scripts": {
                "start": "react-scripts start",
                "test": "react-scripts test",
                "eject": "react-scripts eject",
                "build": "rm -rf ../public/ && react-scripts build && node scripts/copy.js",
                "watch": "cra-build-watch",
                "sass": "node-sass  ./src/styles/scss --output ./public/css/"
        },
        "eslintConfig": {
                "extends": "react-app"
        },
        "browserslist": {
                "production": [
                        ">0.2%",
                        "not dead",
                        "not op_mini all"
                ],
                "development": [
                        "last 1 chrome version",
                        "last 1 firefox version",
                        "last 1 safari version"
                ]
        }
}

When building I get the following output:

npm run watch --react-scripts-version 3.0.0 --verbose
npm info it worked if it ends with ok
npm verb cli [ '/usr/bin/node',
npm verb cli   '/usr/bin/npm',
npm verb cli   'run',
npm verb cli   'watch',
npm verb cli   '--react-scripts-version',
npm verb cli   '3.0.0',
npm verb cli   '--verbose' ]
npm info using npm@5.6.0
npm info using node@v8.11.3
npm verb run-script [ 'prewatch', 'watch', 'postwatch' ]
npm info lifecycle vast-ui-2@0.1.0~prewatch: vast-ui-2@0.1.0
npm info lifecycle vast-ui-2@0.1.0~watch: vast-ui-2@0.1.0

> vast-ui-2@0.1.0 watch /home/user/workspace/vast2/vast-ui
> cra-build-watch "3.0.0"

✔ Update webpack configuration
✔ Clear destination folder
(node:58237) DeprecationWarning: Tapable.plugin is deprecated. Use new API on `.hooks` instead
(node:58237) DeprecationWarning: Tapable.apply is deprecated. Call apply on the plugin directly instead
Error: Plugin could not be registered at 'html-webpack-plugin-before-html-processing'. Hook was not found.
BREAKING CHANGE: There need to exist a hook at 'this.hooks'. To create a compatibility layer for this hook, hook into 'this._pluginCompat'.
    at Compilation.plugin (/home/user/workspace/vast2/vast-ui/node_modules/tapable/lib/Tapable.js:69:9)
    at Compilation.deprecated [as plugin] (internal/util.js:47:15)
    at compiler.plugin.compilation (/home/user/workspace/vast2/vast-ui/node_modules/react-dev-utils/InterpolateHtmlPlugin.js:26:19)
    at SyncHook.eval [as call] (eval at create (/home/user/workspace/vast2/vast-ui/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:7:1)
    at SyncHook.lazyCompileHook (/home/user/workspace/vast2/vast-ui/node_modules/tapable/lib/Hook.js:154:20)
    at Compiler.newCompilation (/home/user/workspace/vast2/vast-ui/node_modules/webpack/lib/Compiler.js:581:26)
    at hooks.beforeCompile.callAsync.err (/home/user/workspace/vast2/vast-ui/node_modules/webpack/lib/Compiler.js:617:29)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/home/user/workspace/vast2/vast-ui/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
    at AsyncSeriesHook.lazyCompileHook (/home/user/workspace/vast2/vast-ui/node_modules/tapable/lib/Hook.js:154:20)
    at Compiler.compile (/home/user/workspace/vast2/vast-ui/node_modules/webpack/lib/Compiler.js:612:28)
    at compiler.hooks.watchRun.callAsync.err (/home/user/workspace/vast2/vast-ui/node_modules/webpack/lib/Watching.js:76:18)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/home/user/workspace/vast2/vast-ui/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:24:1)
    at AsyncSeriesHook.lazyCompileHook (/home/use/workspace/vast2/vast-ui/node_modules/tapable/lib/Hook.js:154:20)
    at Watching._go (/home/user/workspace/vast2/vast-ui/node_modules/webpack/lib/Watching.js:40:32)
    at Watching.compiler.readRecords.err (/home/user/workspace/vast2/vast-ui/node_modules/webpack/lib/Watching.js:32:9)
    at Compiler.readRecords (/home/user/workspace/vast2/vast-ui/node_modules/webpack/lib/Compiler.js:479:11)
npm verb lifecycle vast-ui-2@0.1.0~watch: unsafe-perm in lifecycle true
npm verb lifecycle vast-ui-2@0.1.0~watch: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/user/workspace/vast2/vast-ui/node_modules/.bin:/home/user/bin:/home/user/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
npm verb lifecycle vast-ui-2@0.1.0~watch: CWD: /home/user/workspace/vast2/vast-ui
npm info lifecycle vast-ui-2@0.1.0~watch: Failed to exec watch script
npm verb stack Error: vast-ui-2@0.1.0 watch: `cra-build-watch "3.0.0"`
npm verb stack Exit status 1
npm verb stack     at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:285:16)
npm verb stack     at emitTwo (events.js:126:13)
npm verb stack     at EventEmitter.emit (events.js:214:7)
npm verb stack     at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
npm verb stack     at emitTwo (events.js:126:13)
npm verb stack     at ChildProcess.emit (events.js:214:7)
npm verb stack     at maybeClose (internal/child_process.js:925:16)
npm verb stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
npm verb pkgid vast-ui-2@0.1.0
npm verb cwd /home/users/workspace/vast2/vast-ui
npm verb Linux 4.4.0-97-generic
npm verb argv "/usr/bin/node" "/usr/bin/npm" "run" "watch" "--react-scripts-version" "3.0.0" "--verbose"
npm verb node v8.11.3
npm verb npm  v5.6.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! vast-ui-2@0.1.0 watch: `cra-build-watch "3.0.0"`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the vast-ui-2@0.1.0 watch script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm verb exit [ 1, true ]
Nargonath commented 5 years ago

Please format and highlight your code snippet: https://help.github.com/en/articles/creating-and-highlighting-code-blocks. It is hard to read otherwise.

brymon68 commented 5 years ago

Updated. Sorry

Nargonath commented 5 years ago

That's ok, don't worry. You can also add json next to your opening code block (the ```) to add syntax highlighting.

Would you mind testing with the develop branch? I've upgraded dependencies on it and I wonder if that could be the culprit. In case you wonder how to do, you can use npm link after cloning and npm installing the repo on your local dev env.

Is your project open source? Asking because that could also help me testing if I have access to the project.

Nargonath commented 4 years ago

It should be working. Also you don't need to use the --react-scripts-version it should be working with the 3.0.0 by default.

Closing since no follow-up.