I'm trying to integrate ReactJS
into a Spring
project for the first time, and I'm following this tutorial to do so with Gradle
. I am receiving this error message
basedir=$(dirname "$(echo "$0" | sed -e 's,\,/,g')") ^^^^^^^ SyntaxError: missing ) after argument list at createScript (vm.js:80:10) at Object.runInThisContext (vm.js:139:10) at Module._compile (module.js:599:28) at Object.Module._extensions..js (module.js:646:10) at Module.load (module.js:554:32) at tryModuleLoad (module.js:497:12) at Function.Module._load (module.js:489:3) at Function.Module.runMain (module.js:676:10) at startup (bootstrap_node.js:187:16) at bootstrap_node.js:608:3 :webpack FAILED FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':webpack'.
Process 'command 'C:\Users\KyleLaptop\programming\java\SDV-ModSight.gradle\nodejs\node-v8.9.3-win-x64\node.exe'' finished with non-zero exit value 1
There is a similar question with python
here, but making that change seems to have no effect. I tried hard coding in the webpack.cmd
but it had a similar effect with this error
(function (exports, require, module, __filename, __dirname) { @IF EXIST "%~dp0\node.exe" ( ^SyntaxError: Invalid or unexpected token
It might still be that react
is not reading my OS, or I also read that the problem could be that the program is running shell scripts as javascript
. Here are my
Build.Gradle
buildscript {
ext {
springBootVersion = '1.5.8.RELEASE'
}
repositories {
mavenCentral()
jcenter()
maven{
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-
plugin:${springBootVersion}")
classpath "com.moowork.gradle:gradle-node-plugin:1.2.0"
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
apply plugin: 'war'
apply plugin: 'com.moowork.node'
group = 'org.SDVModSight'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.8
node {
version = '8.9.3'
npmVersion = '5.5.1'
download = true
//distBaseUrl = Custom install location
}
war {
baseName = 'webpack-gradle'
version = '0.0.1'
}
repositories {
mavenCentral()
}
ext {
vaadinVersion = '8.1.0'
}
dependencies {
compile('org.springframework.boot:spring-boot-starter-thymeleaf')
compile('com.vaadin:vaadin-spring-boot-starter')
compile('org.springframework.boot:spring-boot-starter-web')
runtime('org.springframework.boot:spring-boot-devtools')
testCompile('org.springframework.boot:spring-boot-starter-test')
compile('org.webjars:npm:3.9.3')
}
dependencyManagement {
imports {
mavenBom "com.vaadin:vaadin-bom:${vaadinVersion}"
}
}
import com.moowork.gradle.node.task.NodeTask
task webpack(type: NodeTask, dependsOn: 'npmInstall') {
script = project.file('node_modules/.bin/webpack')
}
processResources.dependsOn 'webpack'
clean.delete << file('node_modules')
clean.delete << file('src/main/resources/static/built')
and my package.json
{
"name": "sdvmodsight",
"version": "0.1.0",
"description": "website to handle xnb conflicts",
"repository": {
"type": "git",
"url": "git+ssh://git@github.com/KyMann/SDV-Modsight.git"
},
"author": "Kyle T. Mann",
"bugs": {
"url": "https://github.com/KyMann/SDV-Modsight/issues"
},
"homepage": "https://github.com/KyMann/SDV-Modsight",
"dependencies": {
"react": "^15.6.2",
"react-dom": "^15.3.2",
"rest": "^1.3.1"
},
"scripts": {
"webpack": "webpack --config ./webpack.config.js",
"watch": "webpack --watch -d"
},
"devDependencies": {
"babel-core": "^6.18.2",
"babel-loader": "^6.4.1",
"babel-polyfill": "^6.16.0",
"babel-preset-es2015": "^6.18.0",
"babel-preset-react": "^6.16.0",
"css-loader": "^0.28.7",
"file-loader": "^1.1.6",
"less": "^2.7.3",
"less-loader": "^4.0.5",
"style-loader": "^0.19.1",
"url-loader": "^0.6.2",
"webpack": "^1.15.0"
},
"license": "ISC",
"main": "webpack.config.js",
"keywords": []
}
Been stuck on this for a while. Any help is appreciated.