bitpay / bitcore

A full stack for bitcoin and blockchain-based applications
https://bitcore.io/
MIT License
4.86k stars 2.09k forks source link

NPM RUN NODE #2167

Open ghost opened 5 years ago

ghost commented 5 years ago

sudo npm run node

@8.1.0 node /home/ubuntu/bitcore cd packages/bitcore-node && npm start

bitcore-node@8.3.0 start /home/ubuntu/bitcore/packages/bitcore-node npm run tsc && node build/src/server.js

bitcore-node@8.3.0 tsc /home/ubuntu/bitcore/packages/bitcore-node npm run clean && ./node_modules/.bin/tsc

bitcore-node@8.3.0 clean /home/ubuntu/bitcore/packages/bitcore-node rm -rf build

sh: 1: ./node_modules/.bin/tsc: not found npm ERR! file sh npm ERR! code ELIFECYCLE npm ERR! errno ENOENT npm ERR! syscall spawn npm ERR! bitcore-node@8.3.0 tsc: npm run clean && ./node_modules/.bin/tsc npm ERR! spawn ENOENT npm ERR! npm ERR! Failed at the bitcore-node@8.3.0 tsc script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! /home/ubuntu/.npm/_logs/2019-05-02T09_32_10_505Z-debug.log npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! bitcore-node@8.3.0 start: npm run tsc && node build/src/server.js npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the bitcore-node@8.3.0 start script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! /home/ubuntu/.npm/_logs/2019-05-02T09_32_10_518Z-debug.log npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! @8.1.0 node: cd packages/bitcore-node && npm start npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the @8.1.0 node script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! /home/ubuntu/.npm/_logs/2019-05-02T09_32_10_531Z-debug.log

micahriggan commented 5 years ago

Just a heads up, you shouldn't need to sudo this

About your issue, can you check and see if theres a tsc in the node_modules/.bin folder

If not, could you run npm run bootstrap from the top level of bitcore?

ghost commented 5 years ago

@micahriggan one more

npm run bootstrap

@8.1.0 bootstrap /home/ubuntu/bitcore-8.2.0 lerna bootstrap

lerna notice cli v3.13.4 lerna info Bootstrapping 15 packages lerna info Installing external dependencies lerna ERR! npm install exited 1 in 'crypto-wallet-core' lerna ERR! npm install stderr: npm ERR! path /home/ubuntu/bitcore-8.2.0/packages/crypto-wallet-core/node_modules/websocket npm ERR! code EISGIT npm ERR! git /home/ubuntu/bitcore-8.2.0/packages/crypto-wallet-core/node_modules/websocket: Appears to be a git repo or submodule. npm ERR! git /home/ubuntu/bitcore-8.2.0/packages/crypto-wallet-core/node_modules/websocket npm ERR! git Refusing to remove it. Update manually, npm ERR! git or move it out of the way first.

npm ERR! A complete log of this run can be found in: npm ERR! /home/ubuntu/.npm/_logs/2019-05-02T20_46_10_910Z-debug.log

lerna ERR! npm install exited 1 in 'crypto-wallet-core' npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! @8.1.0 bootstrap: lerna bootstrap npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the @8.1.0 bootstrap script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! /home/ubuntu/.npm/_logs/2019-05-02T20_46_10_937Z-debug.log

Operating System: Ubuntu

dalijolijo commented 5 years ago

I get the same error with npm run node

$ npm run node
[...]
sh: 1: ./node_modules/.bin/tsc: not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! bitcore-node@8.3.0 tsc: `npm run clean && ./node_modules/.bin/tsc`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the bitcore-node@8.3.0 tsc script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2019-05-03T22_01_54_258Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! bitcore-node@8.3.0 start: `npm run tsc && node build/src/server.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the bitcore-node@8.3.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2019-05-03T22_01_54_295Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @8.1.0 node: `cd packages/bitcore-node && npm start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @8.1.0 node script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2019-05-03T22_01_54_334Z-debug.log

But the tsc file exists in the node_modules/.bin folder: image

$ cd ./node_modules/typescript/bin
$ cat tsc
#!/usr/bin/env node
require('../lib/tsc.js')
$ ls ../lib/tsc.js
../lib/tsc.js
BoGnY commented 5 years ago

@AbhinavKorpalVaultbank commented on May 2, 2019 10:48 PM:

@micahriggan one more

npm run bootstrap

@8.1.0 bootstrap /home/ubuntu/bitcore-8.2.0
lerna bootstrap

lerna notice cli v3.13.4
lerna info Bootstrapping 15 packages
lerna info Installing external dependencies
lerna ERR! npm install exited 1 in 'crypto-wallet-core'
lerna ERR! npm install stderr:
npm ERR! path /home/ubuntu/bitcore-8.2.0/packages/crypto-wallet-core/node_modules/websocket
npm ERR! code EISGIT
npm ERR! git /home/ubuntu/bitcore-8.2.0/packages/crypto-wallet-core/node_modules/websocket: Appears to be a git repo or submodule.
npm ERR! git /home/ubuntu/bitcore-8.2.0/packages/crypto-wallet-core/node_modules/websocket
npm ERR! git Refusing to remove it. Update manually,
npm ERR! git or move it out of the way first.

npm ERR! A complete log of this run can be found in:
npm ERR! /home/ubuntu/.npm/_logs/2019-05-02T20_46_10_910Z-debug.log

lerna ERR! npm install exited 1 in 'crypto-wallet-core'
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @8.1.0 bootstrap: lerna bootstrap
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @8.1.0 bootstrap script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /home/ubuntu/.npm/_logs/2019-05-02T20_46_10_937Z-debug.log

Operating System: Ubuntu

You have to delete node_modules dir from packages/crypto-wallet-core before re-run npm run bootstrap..

However, the problem is that the script search ./node_modules/.bin/tsc in bitcore-node subdir packages (which not have tsc binary)... I think somethings during installation don't create symbolik link to tsc and this give the error...

Momently, I have fixed it with:

# enter in your bitcore parent dir:
mkdir packages/bitcore-client/node_modules/.bin
chmod 0755 packages/bitcore-client/node_modules/.bin
ln -s packages/bitcore-client/node_modules/typescript/bin/tsc packages/bitcore-client/node_modules/.bin/tsc

# bitcore-node have the same problem, so fix even this
mkdir packages/bitcore-node/node_modules/.bin
chmod 0755 packages/bitcore-node/node_modules/.bin
ln -s packages/bitcore-node/node_modules/typescript/bin/tsc packages/bitcore-node/node_modules/.bin/tsc

# rerun lerna compilation
node_modules/.bin/lerna run compile

this fixed the problem

ghost commented 5 years ago

@BoGnY I tried: ln: failed to create symbolic link 'packages/bitcore-client/node_modules/.bin/tsc': No such file or directory

Even check the output using npm install:

npm install

@8.1.0 postinstall /home/ubuntu/bitcore-8.2.0 npm run bootstrap && npm run compile

@8.1.0 bootstrap /home/ubuntu/bitcore-8.2.0 lerna bootstrap

lerna notice cli v3.6.0 lerna info Bootstrapping 15 packages lerna info Installing external dependencies lerna ERR! npm install exited 1 in 'bitcore-build' lerna ERR! npm install stderr: npm ERR! Unexpected token } in JSON at position 101851 while parsing near '...on": "3.0.1", npm ERR! }, npm ERR! "dependenci...'

npm ERR! A complete log of this run can be found in: npm ERR! /home/ubuntu/.npm/_logs/2019-05-06T12_24_17_656Z-debug.log

lerna ERR! npm install exited 1 in 'bitcore-build' lerna WARN complete Waiting for 3 child processes to exit. CTRL-C to exit immediately. npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! @8.1.0 bootstrap: lerna bootstrap npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the @8.1.0 bootstrap script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! /home/ubuntu/.npm/_logs/2019-05-06T12_24_17_699Z-debug.log npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! @8.1.0 postinstall: npm run bootstrap && npm run compile npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the @8.1.0 postinstall script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! /home/ubuntu/.npm/_logs/2019-05-06T12_24_17_742Z-debug.log

BoGnY commented 5 years ago

@AbhinavKorpalVaultbank commented on null:

@BoGnY I tried:
ln: failed to create symbolic link 'packages/bitcore-client/node_modules/.bin/tsc': No such file or directory

sorry, I have forgot node_modules in mkdir command.. I have edited the commands, rerun it 👍

ghost commented 5 years ago

@BoGnY as mentioned command works and executed.

node_modules/.bin/lerna run compile lerna notice cli v3.6.0 lerna info Executing command in 3 packages: "npm run compile" lerna ERR! npm run compile exited 1 in 'bitcore-client' lerna ERR! npm run compile stdout:

bitcore-client@8.2.0 compile /home/ubuntu/bitcore-8.2.0/packages/bitcore-client npm run clean && ./node_modules/.bin/tsc

bitcore-client@8.2.0 clean /home/ubuntu/bitcore-8.2.0/packages/bitcore-client rm -rf ./ts_build

lerna ERR! npm run compile stderr: sh: 1: ./node_modules/.bin/tsc: not found npm ERR! file sh npm ERR! code ELIFECYCLE npm ERR! errno ENOENT npm ERR! syscall spawn npm ERR! bitcore-client@8.2.0 compile: npm run clean && ./node_modules/.bin/tsc npm ERR! spawn ENOENT npm ERR! npm ERR! Failed at the bitcore-client@8.2.0 compile script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! /home/ubuntu/.npm/_logs/2019-05-06T13_04_21_779Z-debug.log

lerna ERR! npm run compile exited 1 in 'bitcore-client' lerna WARN complete Waiting for 1 child process to exit. CTRL-C to exit immediately.

The point is even npm install throws an output with an error.

npm install

@8.1.0 postinstall /home/ubuntu/bitcore-8.2.0 npm run bootstrap && npm run compile

@8.1.0 bootstrap /home/ubuntu/bitcore-8.2.0 lerna bootstrap

lerna notice cli v3.6.0 lerna info Bootstrapping 15 packages lerna info Installing external dependencies lerna ERR! npm install exited 1 in 'bitcore-build' lerna ERR! npm install stderr: npm ERR! Unexpected token } in JSON at position 101851 while parsing near '...on": "3.0.1", npm ERR! }, npm ERR! "dependenci...'

npm ERR! A complete log of this run can be found in: npm ERR! /home/ubuntu/.npm/_logs/2019-05-06T13_01_41_463Z-debug.log

lerna ERR! npm install exited 1 in 'bitcore-build' lerna WARN complete Waiting for 3 child processes to exit. CTRL-C to exit immediately. npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! @8.1.0 bootstrap: lerna bootstrap npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the @8.1.0 bootstrap script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! /home/ubuntu/.npm/_logs/2019-05-06T13_01_41_512Z-debug.log npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! @8.1.0 postinstall: npm run bootstrap && npm run compile npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the @8.1.0 postinstall script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! /home/ubuntu/.npm/_logs/2019-05-06T13_01_41_549Z-debug.log

BoGnY commented 5 years ago

@BoGnY as mentioned command works and executed.

for first error, check that your /home/ubuntu/bitcore-8.2.0/packages/bitcore-client/node_modules/.bin/tsc symlink exists and that it point to /home/ubuntu/bitcore-8.2.0/packages/bitcore-client/node_modules/typescript/bin/tsc

for second error, I think you have a corrupted package-lock.json file in bitcore-client dir.. delete it and rerun..

ghost commented 5 years ago

@BoGnY yes symlink exists and that it point to. But node_modules/.bin/lerna run compile throws some error.

node_modules/.bin/lerna run compile
lerna notice cli v3.6.0
lerna info Executing command in 3 packages: "npm run compile"
lerna ERR! npm run compile exited 1 in 'bitcore-client'
lerna ERR! npm run compile stdout:

> bitcore-client@8.2.0 compile /home/ubuntu/bitcore-8.2.0/packages/bitcore-client
> npm run clean && ./node_modules/.bin/tsc

> bitcore-client@8.2.0 clean /home/ubuntu/bitcore-8.2.0/packages/bitcore-client
> rm -rf ./ts_build

lerna ERR! npm run compile stderr:
sh: 1: ./node_modules/.bin/tsc: not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! bitcore-client@8.2.0 compile: `npm run clean && ./node_modules/.bin/tsc`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the bitcore-client@8.2.0 compile script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/ubuntu/.npm/_logs/2019-05-06T13_21_16_599Z-debug.log

lerna ERR! npm run compile exited 1 in 'bitcore-client'
lerna WARN complete Waiting for 1 child process to exit. CTRL-C to exit immediately.
BoGnY commented 5 years ago

you have to run node_modules/.bin/lerna run compile from your /home/ubuntu/bitcore-8.2.0 and not from bitcore-client sub-package

ghost commented 5 years ago

@BoGnY yes running from /home/ubuntu/bitcore-8.2.0

pwd
/home/ubuntu/bitcore-8.2.0
~/bitcore-8.2.0$ sudo node_modules/.bin/lerna run compile
lerna notice cli v3.13.4
lerna info Executing command in 3 packages: "npm run compile"
lerna info run Ran npm script 'compile' in 'bitcore-client' in 5.6s:

> bitcore-client@8.2.0 compile /home/ubuntu/bitcore-8.2.0/packages/bitcore-client
> npm run clean && ./node_modules/.bin/tsc

> bitcore-client@8.2.0 clean /home/ubuntu/bitcore-8.2.0/packages/bitcore-client
> rm -rf ./ts_build

lerna info run Ran npm script 'compile' in 'bitcore-wallet-service' in 8.2s:

> bitcore-wallet-service@8.2.0 compile /home/ubuntu/bitcore-8.2.0/packages/bitcore-wallet-service
> npm run tsc

> bitcore-wallet-service@8.2.0 tsc /home/ubuntu/bitcore-8.2.0/packages/bitcore-wallet-service
> npm run clean &&./node_modules/.bin/tsc

> bitcore-wallet-service@8.2.0 clean /home/ubuntu/bitcore-8.2.0/packages/bitcore-wallet-service
> rm -rf ./ts_build

lerna ERR! npm run compile exited 1 in 'bitcore-node'
lerna ERR! npm run compile stdout:

> bitcore-node@8.2.0 compile /home/ubuntu/bitcore-8.2.0/packages/bitcore-node
> npm run tsc

> bitcore-node@8.2.0 tsc /home/ubuntu/bitcore-8.2.0/packages/bitcore-node
> npm run clean && ./node_modules/.bin/tsc

> bitcore-node@8.2.0 clean /home/ubuntu/bitcore-8.2.0/packages/bitcore-node
> rm -rf build

lerna ERR! npm run compile stderr:
sh: 1: ./node_modules/.bin/tsc: not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! bitcore-node@8.2.0 tsc: `npm run clean && ./node_modules/.bin/tsc`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the bitcore-node@8.2.0 tsc script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/ubuntu/.npm/_logs/2019-05-06T14_53_32_362Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! bitcore-node@8.2.0 compile: `npm run tsc`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the bitcore-node@8.2.0 compile script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/ubuntu/.npm/_logs/2019-05-06T14_53_32_376Z-debug.log

lerna ERR! npm run compile exited 1 in 'bitcore-node'
micahriggan commented 5 years ago

Are you sudo npm installing? If so, that's likely going to conflict with lerna's bootstrapping

Maybe verify that the owner of the files in your node_modules folder is not root.

Could you give me the output of

ls -al packages/bitcore-node/node_modules/.bin

micahriggan commented 5 years ago

Does installing typescript into the top level of bitcore affect this?

BoGnY commented 5 years ago

your bitcore-client is compiled without error.... the problem is now on bitcore-node... have you followed my instruction on both packages (bitcore-client and bitcore-node)????

ghost commented 5 years ago

@micahriggan

ls -al packages/bitcore-node/node_modules/.bin

No it's not root

ghost commented 5 years ago

your bitcore-client is compiled without error.... the problem is now on bitcore-node... have you followed my instruction on both packages (bitcore-client and bitcore-node)????

@BoGnY Yes

ghost commented 5 years ago

@BoGnY @micahriggan Now new kind of error using only npm install:

npm install

> @8.1.0 postinstall /home/ubuntu/bitcore-8.2.0
> npm run bootstrap && npm run compile

> @8.1.0 bootstrap /home/ubuntu/bitcore-8.2.0
> lerna bootstrap

lerna notice cli v3.6.0
lerna info Bootstrapping 15 packages
lerna info Installing external dependencies
lerna info Symlinking packages and binaries
lerna ERR! 
lerna ERR! lerna EACCES: permission denied, symlink '../../bitcore-build' -> '/home/ubuntu/bitcore-8.2.0/packages/bitcore-lib-cash/node_modules/bitcore-build'

> @8.1.0 compile /home/ubuntu/bitcore-8.2.0
> lerna run compile

lerna notice cli v3.6.0
lerna info Executing command in 3 packages: "npm run compile"
lerna ERR! npm run compile exited 1 in 'bitcore-client'
lerna ERR! npm run compile stdout:

> bitcore-client@8.2.0 compile /home/ubuntu/bitcore-8.2.0/packages/bitcore-client
> npm run clean && ./node_modules/.bin/tsc

> bitcore-client@8.2.0 clean /home/ubuntu/bitcore-8.2.0/packages/bitcore-client
> rm -rf ./ts_build

lerna ERR! npm run compile stderr:
sh: 1: ./node_modules/.bin/tsc: not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! bitcore-client@8.2.0 compile: `npm run clean && ./node_modules/.bin/tsc`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the bitcore-client@8.2.0 compile script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/ubuntu/.npm/_logs/2019-05-06T16_01_47_585Z-debug.log

lerna ERR! npm run compile exited 1 in 'bitcore-client'
lerna WARN complete Waiting for 1 child process to exit. CTRL-C to exit immediately.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @8.1.0 compile: `lerna run compile`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the @8.1.0 compile script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/ubuntu/.npm/_logs/2019-05-06T16_01_47_618Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @8.1.0 postinstall: `npm run bootstrap && npm run compile`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the @8.1.0 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/ubuntu/.npm/_logs/2019-05-06T16_01_47_644Z-debug.log
BoGnY commented 5 years ago

sh: 1: ./node_modules/.bin/tsc: not found

your problem is that /home/ubuntu/bitcore-8.2.0/packages/bitcore-client/node_modules/.bin/tsc don't exists...

however, delete your /home/ubuntu/bitcore-8.2.0 dir, and clone again the tag v8.2.0... some commit from tag v8.2.0 to master have broken the compile process...

i've tested it a few hours ago, git clone https://github.com/bitpay/bitcore.git don't compile succesfully, but git clone -b v8.2.0 https://github.com/bitpay/bitcore.git compile without problem..

ApolloMuses commented 5 years ago

Environment: ubuntu 16.04 node: 10.15.2 npm: 6.4.1 nvm: 0.34.0

(same errors using node v8.15.0 & npm 6.4.1)

cloning the v8.2.0 is still giving the same errors.

I've tried removing node modules, deleting package-lock...either giving error status 1 or error status 2.

Any ideas?

ubuntu@ip-172-31-32-21:~/bitcore$ npm i

> @8.1.0 postinstall /home/ubuntu/bitcore
> npm run bootstrap && npm run compile

> @8.1.0 bootstrap /home/ubuntu/bitcore
> lerna bootstrap

lerna notice cli v3.6.0
lerna info Bootstrapping 15 packages
lerna info Installing external dependencies
lerna ERR! npm install exited 1 in 'bitcore-build'
lerna ERR! npm install stderr:
npm ERR! Unexpected token } in JSON at position 101851 while parsing near '...on": "3.0.1",
npm ERR!       },
npm ERR!       "dependenci...'

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/ubuntu/.npm/_logs/2019-05-15T19_29_21_268Z-debug.log

lerna ERR! npm install exited 1 in 'bitcore-build'
lerna WARN complete Waiting for 3 child processes to exit. CTRL-C to exit immediately.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @8.1.0 bootstrap: `lerna bootstrap`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @8.1.0 bootstrap script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/ubuntu/.npm/_logs/2019-05-15T19_29_21_315Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @8.1.0 postinstall: `npm run bootstrap && npm run compile`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @8.1.0 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/ubuntu/.npm/_logs/2019-05-15T19_29_21_364Z-debug.log

Logs:

68 error errno 1
69 error @8.1.0 postinstall: `npm run bootstrap && npm run compile`
69 error Exit status 1
70 error Failed at the @8.1.0 postinstall script.
70 error This is probably not a problem with npm. There is likely additional logging output above.
71 verbose exit [ 1, true ]
52 silly postinstall @8.1.0
53 info lifecycle @8.1.0~postinstall: @8.1.0
54 verbose lifecycle @8.1.0~postinstall: unsafe-perm in lifecycle true
55 verbose lifecycle @8.1.0~postinstall: PATH: /home/ubuntu/.nvm/versions/node/v8.15.0/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/ubuntu/bitcore/node_modules/.bin:/home/ubuntu/bin:/home/ubuntu/.local/bin:/home/ubuntu/.nvm/versions/node/v8.15.0/b$
56 verbose lifecycle @8.1.0~postinstall: CWD: /home/ubuntu/bitcore
57 silly lifecycle @8.1.0~postinstall: Args: [ '-c', 'npm run bootstrap && npm run compile' ]
58 silly lifecycle @8.1.0~postinstall: Returned: code: 1  signal: null
59 info lifecycle @8.1.0~postinstall: Failed to exec postinstall script
60 verbose stack Error: @8.1.0 postinstall: `npm run bootstrap && npm run compile`
60 verbose stack Exit status 1
60 verbose stack     at EventEmitter.<anonymous> (/home/ubuntu/.nvm/versions/node/v8.15.0/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
60 verbose stack     at emitTwo (events.js:126:13)
60 verbose stack     at EventEmitter.emit (events.js:214:7)
60 verbose stack     at ChildProcess.<anonymous> (/home/ubuntu/.nvm/versions/node/v8.15.0/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
60 verbose stack     at emitTwo (events.js:126:13)
60 verbose stack     at ChildProcess.emit (events.js:214:7)
60 verbose stack     at maybeClose (internal/child_process.js:915:16)
60 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
61 verbose pkgid @8.1.0
62 verbose cwd /home/ubuntu/bitcore
63 verbose Linux 4.4.0-1075-aws
64 verbose argv "/home/ubuntu/.nvm/versions/node/v8.15.0/bin/node" "/home/ubuntu/.nvm/versions/node/v8.15.0/bin/npm" "i"
65 verbose node v8.15.0
66 verbose npm  v6.4.1
67 error code ELIFECYCLE
68 error errno 1
69 error @8.1.0 postinstall: `npm run bootstrap && npm run compile`
69 error Exit status 1
70 error Failed at the @8.1.0 postinstall script.
70 error This is probably not a problem with npm. There is likely additional logging output above.
71 verbose exit [ 1, true ]

@micahriggan output of ls -al packages/bitcore-node/node_modules/.bin

tsc -> packages/bitcore-node/node_modules/typescript/bin/tsc

WesNz commented 5 years ago

Having same issue. this just dont work.

sudo npm run node

@8.1.0 node /home/ubuntu/Desktop/bitcore cd packages/bitcore-node && npm start

bitcore-node@8.3.0 start /home/ubuntu/Desktop/bitcore/packages/bitcore-node npm run tsc && node build/src/server.js

bitcore-node@8.3.0 tsc /home/ubunutu/Desktop/bitcore/packages/bitcore-node npm run clean && ./node_modules/.bin/tsc

bitcore-node@8.3.0 clean /home/ubuntu/Desktop/bitcore/packages/bitcore-node rm -rf build

sh: 1: ./node_modules/.bin/tsc: not found npm ERR! file sh npm ERR! code ELIFECYCLE npm ERR! errno ENOENT

WesNz commented 5 years ago

npm ERR! Unexpected token } in JSON at position 101851 while parsing near '...on": "3.0.1", npm ERR! }, npm ERR! "dependenci...'

iv got this same issue! driving me fucking nuts! tried searching all the .json files with no luck!

micahriggan commented 5 years ago

Are you on latest master with this package-lock issue?

WesNz commented 5 years ago

Are you on latest master with this package-lock issue?

yep. https://github.com/bitpay/bitcore/releases v8.2.0

WesNz commented 5 years ago

trying git clone https://github.com/bitpay/bitcore.git now

micahriggan commented 5 years ago

Oh I see, didn't realize the releases were being used. I recommend cloning the repo with git and checking out master. It seems like a bad release was published, Ill ask about removing it and publishing a new one. Thanks for the report, I'm sure others are using this release as well

WesNz commented 5 years ago

seems like it worked, see below! Just gotta figure out the mongodb part.

Also noticed sudo created headaches! i didnt use any sudo commands, also for git clone

thanks man! was going insane!


bitcore-node@8.3.0 clean /home/ubuntu/Desktop/bitcore/packages/bitcore-node rm -rf build

lerna success run Ran npm script 'compile' in 4 packages in 22.9s: lerna success - bitcore-client lerna success - bitcore-node lerna success - bitcore-wallet-service lerna success - crypto-wallet-core

┌──────────────────────────────────────────────────────────┐ │ npm update check failed │ │ Try running with sudo or get access │ │ to the local update config store via │ │ sudo chown -R $USER:$(id -gn $USER) /home/ubuntu/.config │ └──────────────────────────────────────────────────────────┘ npm WARN @8.1.0 No repository field. npm WARN @8.1.0 No license field.

added 719 packages from 675 contributors and audited 1492541 packages in 237.799s found 991 vulnerabilities (49 moderate, 942 high) run npm audit fix to fix them, or npm audit for details

┌──────────────────────────────────────────────────────────┐ │ npm update check failed │ │ Try running with sudo or get access │ │ to the local update config store via │ │ sudo chown -R $USER:$(id -gn $USER) /home/ubuntu/.config │ └──────────────────────────────────────────────────────────┘ ubuntu@ubuntu:~/Desktop/bitcore$ npm run node

@8.1.0 node /home/ubuntu/Desktop/bitcore cd packages/bitcore-node && npm start

bitcore-node@8.3.0 start /home/ubuntu/Desktop/bitcore/packages/bitcore-node npm run tsc && node build/src/server.js

bitcore-node@8.3.0 tsc /home/ubuntu/Desktop/bitcore/packages/bitcore-node npm run clean && ./node_modules/.bin/tsc

bitcore-node@8.3.0 clean /home/ubuntu/Desktop/bitcore/packages/bitcore-node rm -rf build

┌──────────────────────────────────────────────────────────┐ │ npm update check failed │ │ Try running with sudo or get access │ │ to the local update config store via │ │ sudo chown -R $USER:$(id -gn $USER) /home/ubuntu/.config │ └──────────────────────────────────────────────────────────┘

┌──────────────────────────────────────────────────────────┐ │ npm update check failed │ │ Try running with sudo or get access │ │ to the local update config store via │ │ sudo chown -R $USER:$(id -gn $USER) /home/ubuntu/.config │ └──────────────────────────────────────────────────────────┘ error: MongoNetworkError: failed to connect to server [127.0.0.1:27017] on first connect [MongoNetworkError: connect ECONNREFUSED 127.0.0.1:27017]

ApolloMuses commented 5 years ago

Well got it to install properly finally but still getting script errors with npm run node:

> @8.1.0 node /home/ubuntu/bitcore
> cd packages/bitcore-node && npm start

> bitcore-node@8.3.0 start /home/ubuntu/bitcore/packages/bitcore-node
> npm run tsc && node build/src/server.js

> bitcore-node@8.3.0 tsc /home/ubuntu/bitcore/packages/bitcore-node
> npm run clean && ./node_modules/.bin/tsc

> bitcore-node@8.3.0 clean /home/ubuntu/bitcore/packages/bitcore-node
> rm -rf build

module.js:550
    throw err;
    ^

Error: Cannot find module './build/Release/scrypt'
    at Function.Module._resolveFilename (module.js:548:15)
    at Function.Module._load (module.js:475:25)
    at Module.require (module.js:597:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/home/ubuntu/bitcore/packages/bitcore-node/node_modules/scrypt/index.js:3:20)
    at Module._compile (module.js:653:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! bitcore-node@8.3.0 start: `npm run tsc && node build/src/server.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the bitcore-node@8.3.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/ubuntu/.npm/_logs/2019-05-22T00_55_53_796Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @8.1.0 node: `cd packages/bitcore-node && npm start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @8.1.0 node script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/ubuntu/.npm/_logs/2019-05-22T00_55_53_808Z-debug.log
micahriggan commented 5 years ago

That seems like you don't have the scrypt module built. You may need to do an npm rebuild

ApolloMuses commented 5 years ago

Thanks for the fast response! I just ran npm rebuild followed by npm run node but still got the same error...

> @8.1.0 node /home/ubuntu/bitcore
> cd packages/bitcore-node && npm start

> bitcore-node@8.3.0 start /home/ubuntu/bitcore/packages/bitcore-node
> npm run tsc && node build/src/server.js

> bitcore-node@8.3.0 tsc /home/ubuntu/bitcore/packages/bitcore-node
> npm run clean && ./node_modules/.bin/tsc

> bitcore-node@8.3.0 clean /home/ubuntu/bitcore/packages/bitcore-node
> rm -rf build

module.js:550
    throw err;
    ^

Error: Cannot find module './build/Release/scrypt'
    at Function.Module._resolveFilename (module.js:548:15)
    at Function.Module._load (module.js:475:25)
    at Module.require (module.js:597:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/home/ubuntu/bitcore/packages/bitcore-node/node_modules/scrypt/index.js:3:20)
    at Module._compile (module.js:653:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! bitcore-node@8.3.0 start: `npm run tsc && node build/src/server.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the bitcore-node@8.3.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/ubuntu/.npm/_logs/2019-05-22T01_14_43_076Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @8.1.0 node: `cd packages/bitcore-node && npm start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @8.1.0 node script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/ubuntu/.npm/_logs/2019-05-22T01_14_43_088Z-debug.log
ApolloMuses commented 5 years ago

Here's the full error log:

0 info it worked if it ends with ok
1 verbose cli [ '/home/ubuntu/.nvm/versions/node/v8.16.0/bin/node',
1 verbose cli   '/home/ubuntu/.nvm/versions/node/v8.16.0/bin/npm',
1 verbose cli   'start' ]
2 info using npm@6.4.1
3 info using node@v8.16.0
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle bitcore-node@8.3.0~prestart: bitcore-node@8.3.0
6 info lifecycle bitcore-node@8.3.0~start: bitcore-node@8.3.0
7 verbose lifecycle bitcore-node@8.3.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle bitcore-node@8.3.0~start: PATH: /home/ubuntu/.nvm/versions/node/v8.16.0/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-$
9 verbose lifecycle bitcore-node@8.3.0~start: CWD: /home/ubuntu/bitcore/packages/bitcore-node
10 silly lifecycle bitcore-node@8.3.0~start: Args: [ '-c', 'npm run tsc && node build/src/server.js' ]
11 silly lifecycle bitcore-node@8.3.0~start: Returned: code: 1  signal: null
12 info lifecycle bitcore-node@8.3.0~start: Failed to exec start script
13 verbose stack Error: bitcore-node@8.3.0 start: `npm run tsc && node build/src/server.js`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (/home/ubuntu/.nvm/versions/node/v8.16.0/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:30$
13 verbose stack     at emitTwo (events.js:126:13)
13 verbose stack     at EventEmitter.emit (events.js:214:7)
13 verbose stack     at ChildProcess.<anonymous> (/home/ubuntu/.nvm/versions/node/v8.16.0/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.j$
13 verbose stack     at emitTwo (events.js:126:13)
13 verbose stack     at ChildProcess.emit (events.js:214:7)
13 verbose stack     at maybeClose (internal/child_process.js:915:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
14 verbose pkgid bitcore-node@8.3.0
15 verbose cwd /home/ubuntu/bitcore/packages/bitcore-node
16 verbose Linux 4.15.0-1032-aws
17 verbose argv "/home/ubuntu/.nvm/versions/node/v8.16.0/bin/node" "/home/ubuntu/.nvm/versions/node/v8.16.0/bin/npm" "start"
18 verbose node v8.16.0
19 verbose npm  v6.4.1
20 error code ELIFECYCLE
21 error errno 1
22 error bitcore-node@8.3.0 start: `npm run tsc && node build/src/server.js`
22 error Exit status 1
23 error Failed at the bitcore-node@8.3.0 start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
micahriggan commented 5 years ago

I have an idea, try npm install -g scrypt and see of there are errors. That's using some c build stuff, so it could be missing

ApolloMuses commented 5 years ago

script v6.0.3 was install with no errors globally but npm run node still having same errors?

Cannot find module './build/Release/scrypt'

WesNz commented 5 years ago

script v6.0.3 was install with no errors globally but npm run node still having same errors?

Cannot find module './build/Release/scrypt'

I dunno if this helps but yeah. node -v = v8.16.0 npm -v = 6.4.1 Ubuntu 16.04

Commands i used git clone https://github.com/bitpay/bitcore.git npm install npm run node (dont forget your bitcore.config.json)

ApolloMuses commented 5 years ago

Yeah I'm doing the same thing only difference is that Im using ubuntu 18 and for bitcore.config.json I just copy the default info given to get it running first.

WesNz commented 5 years ago

Yeah I'm doing the same thing only difference is that Im using ubuntu 18 and for bitcore.config.json I just copy the default info given to get it running first.

iv come across certain apps not liking ubuntu 14 / ubuntu 18....maybe bitcore is one of them? maybe @micahriggan can help on that answer?

ApolloMuses commented 5 years ago

Yeah :/ its weird though because I have an older bitcore v4.1 running on ubuntu 18. just can't get this new integrated v8 running :/ I'm trying to test the BCH library and would like to upgrade the bitcore 4.1 but this installation issue is keeping me from it xD

Thanks for your help though!

ApolloMuses commented 5 years ago

Ahh finally @WesNz , so with v16 I got to where you got with the mongo db error! :D Finally! After installing mongo and starting it, its finally working! :D Now to get BCH working...

WesNz commented 5 years ago

Haha that's awesome!

crypto-rizzo commented 4 years ago

@micahriggan been stuck on this bug for the entire morning. Seems like it's a problem with node v12. was able to run node v11 and get npm install to work.

Also found a fix for running node v12. If you upgrade abi-decoder from 2.0.1 -> 2.1.0, the problem is resolved.

micahriggan commented 4 years ago

Yeah, node 12 isn't working right now

I have a PR where I got bitcore-node running on 12, but I need to make sure that BWS etc are compatibile.

https://github.com/bitpay/bitcore/pull/2733/files

crypto-rizzo commented 4 years ago

@micahriggan hmm ok, so I was able to succesfully install all the packages using node 12 after upgrading abi-decoder

after running npm run node, though, I'm running into a new error. Tried using node10, 11, and 12 and all hit the same error. any ideas based on log below?

Error: Cannot find module './build/Debug/addon'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
    at Function.Module._load (internal/modules/cjs/loader.js:562:25)
    at Module.require (internal/modules/cjs/loader.js:690:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (/home/kevin/Desktop/projects/bitcore/packages/bitcore-node/node_modules/heapdump/index.js:19:15)
    at Module._compile (internal/modules/cjs/loader.js:776:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:690:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (/home/kevin/Desktop/projects/bitcore/packages/bitcore-node/src/workers/all.ts:11:1)
    at Module._compile (internal/modules/cjs/loader.js:776:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
crypto-rizzo commented 4 years ago

do you have a version of node you'd recommend using? @micahriggan

micahriggan commented 4 years ago

That error is from the heapdump package being required in all the packages.

I had to remove it from those files to get it to work (in the pr), but you may just need to do a npm rebuild

Currently it should work with 8.15, or 10 and 11.

Node 12 definitely doesn't work (yet)

crypto-rizzo commented 4 years ago

Thanks for the explanation!

My problem was that I sucessfully ran npm install with Node 12 (after changing the abi-decoder version). However, despite the succesful installation, Node12 will hit errors on npm run node.

Wiped the directory, downgraded to 10.19.0, and did a fresh install. Looks like that fixed things :+1: