admin管理员组

文章数量:1189386

I recently upgraded Node.js to version 10.5.0 in my build.gradle file. However, I am encountering the following errors when running ./gradlew npm_run_build:

node_modules/@types/sinon/index.d.ts(1534,35): error TS1128: Declaration or statement expected. node_modules/@types/sinon/index.d.ts(1534,48): error TS1011: An element access expression should take an argument. node_modules/@types/sinon/index.d.ts(1534,56): error TS1011: An element access expression should take an argument. node_modules/@types/sinon/index.d.ts(1535,13): error TS1109: Expression expected. node_modules/@types/sinon/index.d.ts(1535,26): error TS1011: An element access expression should take an argument. node_modules/@types/sinon/index.d.ts(1536,9): error TS1128: Declaration or statement expected. node_modules/@types/sinon/index.d.ts(1536,10): error TS1128: Declaration or statement expected. node_modules/@types/sinon/index.d.ts(1536,41): error TS1005: '(' expected. node_modules/@types/sinon/index.d.ts(1537,5): error TS1128: Declaration or statement expected. node_modules/@types/sinon/index.d.ts(1747,1): error TS1128: Declaration or statement expected. node_modules/@types/xmldom/index.d.ts(1,1): error TS1084: Invalid 'reference' directive syntax.

Here are the relevant info of my configuration files:

build.gradle config for node js

plugins {
    id 'com.marklogic.ml-gradle' version '5.0.0'
    id 'java'
    id 'idea'
    id("com.github.node-gradle.node") version "2.2.0"
}
node {
    version = '10.5.0'
    npmVersion = '6.9.0'
    download = true
}
npm_run_clean {
    args = ['--loglevel', 'silent']
}

npm_run_build {
    args = ['--loglevel', 'silent']
}
npm_run_test {
    args = ['--loglevel', 'silent']
}

tsconfig.json

{
  "compilerOptions": {
    "module": "CommonJS",
    "noImplicitAny": false,
    "sourceMap": true,
    "baseUrl": ".",
    "target": "ES6"
  },
  "files": [
    "./node_modules/marklogic-typescript-definitions/ts/index.d.ts",
  ],
  "include": [
    "./src/**/*.ts",
    "./src/custom.d.ts"
  ]
}

In package.json, we have following dependencies

 "devDependencies": {
    "@types/chai": "4.x",
    "@types/chai-xml": "^0.3.1",
    "@types/decimal.js": "0.0.31",
    "@types/lodash": "4.x",
    "@types/mocha": "*",
    "@types/node": "^10.5.2",
    "@types/sinon": "*",
    "@types/xmldom": "0.1.x",
    "chai": "^4.4.1",
    "chai-xml": "^0.4.1",
    "del": "3.0.0",
    "kind-of": "^6.0.3",
    "lodash": "^4.17.21",
    "marklogic-test-harness": "^0.4.3",
    "marklogic-typescript-definitions": "0.5.0",
    "mocha": "^9.2.2",
    "mocha-teamcity-reporter": "2.x",
    "moment": "^2.30.1",
    "nise": "^6.0.0",
    "nyc": "15.x",
    "rimraf": "^5.0.7",
    "rollup": "^2.0.0",
    "rollup-plugin-commonjs": "^9.2.0",
    "rollup-pluginutils": "^2.8.2",
    "sinon": "4.0.0",
    "source-map-support": "^0.4.11",
    "ts-node": "^8.0.0",
    "tslib": "^1.9.3",
    "tslint": "5.x",
    "typescript": "^2.9.2",
    "xml-js": "1.5.1",
    "xmldom": "^0.6.0",
    "xpath": "0.0.24"
  },
  "dependencies": {
    "braces": "^3.0.3",
    "cross-spawn": "^7.0.6",
    "diff": "^3.3.1",
    "glob": "^10.4.1",
    "just-extend": "^4.0.0",
    "micromatch": "^4.0.7",
    "minimist": "^1.2.6",
    "ml-xmldom": "^0.1.27",
    "node": "^10.5.0",
    "semver": "^6.3.1"
  }
}

I have tried different Node.js versions, but the issue persists. Could someone please suggest any solutions or workarounds to fix this issue?

本文标签: Error when running gradlew npmrunbuild after upgrading Nodejs to version 1050 in gradleStack Overflow