roxhens
roxhens

Reputation: 552

Error while compiling the project with npm

I am trying to get a project running and when I execute the npm install it installs all the dependencies. But after that I try to execute npm run compile and it gives me an error.

Here is the log file for better understanding the error.

0 info it worked if it ends with ok
1 verbose cli [ '/Users/roxhens/.nvm/versions/node/v10.13.0/bin/node',
1 verbose cli   '/Users/roxhens/.nvm/versions/node/v10.13.0/bin/npm',
1 verbose cli   'run',
1 verbose cli   'build' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle [email protected]~prebuild: [email protected]
6 info lifecycle [email protected]~build: [email protected]
7 verbose lifecycle [email protected]~build: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~build: PATH: /Users/roxhens/.nvm/versions/node/v10.13.0/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/roxhens/Desktop/GitHub/jsonforms-tooling/jsonforms-tooling-common/node_modules/.bin:/Users/roxhens/Desktop/GitHub/jsonforms-tooling/jsonforms-tooling-common/node_modules/.bin:/Users/roxhens/Desktop/GitHub/jsonforms-tooling/node_modules/.bin:/Users/roxhens/Desktop/GitHub/node_modules/.bin:/Users/roxhens/Desktop/node_modules/.bin:/Users/roxhens/node_modules/.bin:/Users/node_modules/.bin:/node_modules/.bin:/Users/roxhens/.nvm/versions/node/v10.13.0/bin:/Users/roxhens/.nvm/versions/node/v10.13.0/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/roxhens/Desktop/GitHub/jsonforms-tooling/node_modules/.bin:/Users/roxhens/.nvm/versions/node/v10.13.0/bin:/Library/Frameworks/Python.framework/Versions/3.6/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Frameworks/Python.framework/Versions/3.6/bin
9 verbose lifecycle [email protected]~build: CWD: /Users/roxhens/Desktop/GitHub/jsonforms-tooling/jsonforms-tooling-common
10 silly lifecycle [email protected]~build: Args: [ '-c', 'npm run compile' ]
11 silly lifecycle [email protected]~build: Returned: code: 2  signal: null
12 info lifecycle [email protected]~build: Failed to exec build script
13 verbose stack Error: [email protected] build: `npm run compile`
13 verbose stack Exit status 2
13 verbose stack     at EventEmitter.<anonymous> (/Users/roxhens/.nvm/versions/node/v10.13.0/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
13 verbose stack     at EventEmitter.emit (events.js:182:13)
13 verbose stack     at ChildProcess.<anonymous> (/Users/roxhens/.nvm/versions/node/v10.13.0/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:182:13)
13 verbose stack     at maybeClose (internal/child_process.js:962:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
14 verbose pkgid [email protected]
15 verbose cwd /Users/roxhens/Desktop/GitHub/jsonforms-tooling/jsonforms-tooling-common
16 verbose Darwin 18.2.0
17 verbose argv "/Users/roxhens/.nvm/versions/node/v10.13.0/bin/node" "/Users/roxhens/.nvm/versions/node/v10.13.0/bin/npm" "run" "build"
18 verbose node v10.13.0
19 verbose npm  v6.4.1
20 error code ELIFECYCLE
21 error errno 2
22 error [email protected] build: `npm run compile`
22 error Exit status 2
23 error Failed at the [email protected] build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 2, true ]

This is the package.json in the project root directory.

{
  "scripts": {
    "lerna": "lerna",
    "coveralls": "ts-jest --coverage && cat ./tests/coverage/lcov.info | coveralls",
    "postinstall": "npm run lernabootstrap && npm run lernainstall",
    "lernainstall": "lerna exec --no-bail --npm-ci-mode -- npm run custominstall",
    "lernabootstrap": "lerna bootstrap --npm-ci-mode --ignore-scripts",
    "compile": "lerna run build",
    "lint": "lerna run lint"
  },
  "devDependencies": {
    "@types/jest": "^23.3.11",
    "@types/node": "^10.12.10",
    "coveralls": "^3.0.2",
    "jest": "^23.6.0",
    "lerna": "^3.4.3",
    "rimraf": "2.6.3",
    "ts-jest": "^23.10.4",
    "tslint": "^5.11.0",
    "tslint-react": "^3.6.0",
    "typescript": "^3.1.6",
    "vscode": "^1.1.21"
  },
  "dependencies": {
    "@jsonforms/core": "^2.0.12",
    "simple-git": "^1.107.0"
  }
}

Upvotes: 1

Views: 1829

Answers (2)

roxhens
roxhens

Reputation: 552

I still cannot find the reason why that error, but I managed to fix it by deleting the files and cloning the repository again.

Upvotes: 0

Marouane Fazouane
Marouane Fazouane

Reputation: 1329

I guess that you're trying to build the following:

https://github.com/eclipsesource/jsonforms-tooling

When trying to build libraries found on GitHub (or elsewhere), you can look at how they build it on their CI or look at some other scripts. It seems that for this particular lib, their .travis.yml does not contain everything to make it work on all platforms.

I fiddled with it for a bit and running these (rather straightforward) commands from the root folder should solve your problem:

git clone https://github.com/eclipsesource/jsonforms-tooling
cd jsonforms-tooling
npm install
npm run compile

Upvotes: 2

Related Questions