I am working through Digital Asset Getting Started with Node.js bindings.
Running
npm install #da/daml-ledger
causes the following error message
npm ERR! code E401
npm ERR! 401 Unauthorized: #da/daml-ledger#latest
npm ERR! A complete log of this run can be found in:
npm ERR! /...../.npm/_logs/2019-02-22T17_48_44_560Z-debug.log
here are the contents of that log file:
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/lib/nodejs/node-v10.15.1-linux-x64/bin/node',
1 verbose cli '/usr/local/lib/nodejs/node-v10.15.1-linux-x64/bin/npm',
1 verbose cli 'install',
1 verbose cli '#da/daml-ledger' ]
2 info using npm#6.4.1
3 info using node#v10.15.1
4 verbose npm-session 99e5e60df68735cb
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 http fetch GET 401 https://api.bintray.com/npm/digitalassetsdk/npm/#da%2fdaml-ledger 411ms
8 silly fetchPackageMetaData error for #da/daml-ledger#latest 401 Unauthorized: #da/daml-ledger#latest
9 timing stage:rollbackFailedOptional Completed in 4ms
10 timing stage:runTopLevelLifecycles Completed in 515ms
11 verbose stack Error: 401 Unauthorized: #da/daml-ledger#latest
11 verbose stack at fetch.then.res (/usr/local/lib/nodejs/node-v10.15.1-linux-x64/lib/node_modules/npm/node_modules/pacote/lib/fetchers/registry/fetch.j
s:42:19)
11 verbose stack at tryCatcher (/usr/local/lib/nodejs/node-v10.15.1-linux-x64/lib/node_modules/npm/node_modules/bluebird/js/release/util.js:16:23)
11 verbose stack at Promise._settlePromiseFromHandler (/usr/local/lib/nodejs/node-v10.15.1-linux-x64/lib/node_modules/npm/node_modules/bluebird/js/relea
se/promise.js:512:31)
11 verbose stack at Promise._settlePromise (/usr/local/lib/nodejs/node-v10.15.1-linux-x64/lib/node_modules/npm/node_modules/bluebird/js/release/promise.
js:569:18)
11 verbose stack at Promise._settlePromise0 (/usr/local/lib/nodejs/node-v10.15.1-linux-x64/lib/node_modules/npm/node_modules/bluebird/js/release/promise
.js:614:10)
11 verbose stack at Promise._settlePromises (/usr/local/lib/nodejs/node-v10.15.1-linux-x64/lib/node_modules/npm/node_modules/bluebird/js/release/promise
.js:693:18)
11 verbose stack at Async._drainQueue (/usr/local/lib/nodejs/node-v10.15.1-linux-x64/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:133:
16)
11 verbose stack at Async._drainQueues (/usr/local/lib/nodejs/node-v10.15.1-linux-x64/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:143
:10)
11 verbose stack at Immediate.Async.drainQueues [as _onImmediate] (/usr/local/lib/nodejs/node-v10.15.1-linux-x64/lib/node_modules/npm/node_modules/blueb
ird/js/release/async.js:17:14)
11 verbose stack at runCallback (timers.js:705:18)
11 verbose stack at tryOnImmediate (timers.js:676:5)
11 verbose stack at processImmediate (timers.js:658:5)
12 verbose cwd /home/vantage/DAnodeBindings
13 verbose Linux 4.15.0-45-generic
14 verbose argv "/usr/local/lib/nodejs/node-v10.15.1-linux-x64/bin/node" "/usr/local/lib/nodejs/node-v10.15.1-linux-x64/bin/npm" "install" "#da/daml-ledger"
15 verbose node v10.15.1
16 verbose npm v6.4.1
17 error code E401
18 error 401 Unauthorized: #da/daml-ledger#latest
19 verbose exit [ 1, true ]
I followed the instructions in step 1 and step 2. my .npmrc is updated with the response I received from entering
curl -umehul#digitalassetsdk:<API_KEY> https://api.bintray.com/npm/digitalassetsdk/npm/auth/scope/da
and I entered the command
npm config set #da:registry https://api.bintray.com/npm/digitalassetsdk/npm
What is causing the error?
From the comments it appears you missed a step of the setup, namely as the instructions tell you to paste the response of curl to ~/.npmrc.
The response should be pasted in the ~/.npmrc (in Windows %USERPROFILE%/.npmrc) file.
As an alternative, on Linux and MacOS you can just pipe the output of curl to ~/.npmrc as follows:
curl -u<USERNAME>:<API_KEY> https://api.bintray.com/npm/digitalassetsdk/npm/auth/scope/da >> ~/.npmrc
Using the >> operator will preserve the current content of ~/.npmrc and append the output of curl to the file (or create it if it's not there yet). If you want to overwrite the current ~/.npmrc file, just use the > operator instead.
The Bintary 'Set Me Up' Instructions (referenced in step 1.3 of https://docs.daml.com/app-dev/bindings-js/getting-started.html) say to run a curl command and the to run
npm config set #<SCOPE>:registry https://api.bintray.com/npm/digitalassetsdk/npm
When I skip the npm config step I have no problems.
Related
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'install',
1 verbose cli 'react-bootstrap',
1 verbose cli 'bootstrap'
1 verbose cli ]
2 info using npm#6.14.4
3 info using node#v12.17.0
4 verbose npm-session 4004d1d4d37ac517
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 http fetch GET 200 https://registry.npmjs.org/react-bootstrap 521ms
8 silly fetchPackageMetaData error for react-bootstrap#latest Unexpected end of JSON input while parsing near '...,"requirejs":"~2.1.9"'
9 http fetch GET 200 https://registry.npmjs.org/bootstrap 521ms
10 silly fetchPackageMetaData error for bootstrap#latest Unexpected end of JSON input while parsing near '...7bc2df7ec608869c9c8",'
11 timing stage:rollbackFailedOptional Completed in 0ms
12 timing stage:runTopLevelLifecycles Completed in 3560ms
13 verbose stack SyntaxError: Unexpected end of JSON input while parsing near '...,"requirejs":"~2.1.9"'
13 verbose stack at JSON.parse (<anonymous>)
13 verbose stack at parseJson (C:\Program Files\nodejs\node_modules\npm\node_modules\json-parse-better-errors\index.js:7:17)
13 verbose stack at C:\Program Files\nodejs\node_modules\npm\node_modules\node-fetch-npm\src\body.js:96:50
13 verbose stack at processTicksAndRejections (internal/process/task_queues.js:97:5)
14 verbose cwd D:\Talk2Tutor\material-kit-react-master
15 verbose Windows_NT 10.0.17134
16 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "react-bootstrap" "bootstrap"
17 verbose node v12.17.0
18 verbose npm v6.14.4
19 error Unexpected end of JSON input while parsing near '...,"requirejs":"~2.1.9"'
20 verbose exit [ 1, true ]
I got above error while running npm i react-bootstrap bootstrap. After the error occurred, I tried npm cache clean --force but it didn't resolve my problem. Then I reinstalled node and tried to install dependencies but I still get an error and installation is failed. Any one fixed this error. I tried all the things mentioned in the related question. But it didn't solve my problem. I use node v12.17.0 and npm 6.14.4.
I tried by executing command npm cache clean --force and then executed the command that caused this error and it worked fine.
Upgrade npm using npm-windows-upgrade solved the issue.
After running the command npm cache clean --force . You need to remove the package-lock.json file. This worked for me.
Popper.js is required if you're using Bootstrap JS. Check the docs
I am currently using node version 10.10.0 and npm version 6.4.1 Trying to install firebase CLI to work on cloud functions for the firebase project already created. It is working fine on other systems but is unable to install firebase-tools on my MAC. I have also installed a fresh version of node in hope of getting this error rectified but it did not help. I also tried using 'sudo' and '--force' with npm to install but it also did not help. Here is a complete log of the error i got. Please help
Here is the error log
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/Cellar/node/10.10.0/bin/node',
1 verbose cli '/usr/local/bin/npm',
1 verbose cli 'install',
1 verbose cli '-g',
1 verbose cli 'firebase-tools' ]
2 info using npm#6.4.1
3 info using node#v10.10.0
4 verbose npm-session 402be1d1b21d5c2d
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 http fetch GET 304 https://registry.npmjs.org/firebase-tools 297ms (from cache)
8 silly fetchPackageMetaData error for firebase-tools#latest Unexpected end of JSON input while parsing near '...x","firebase":"~1.0.1'
9 timing stage:rollbackFailedOptional Completed in 1ms
10 timing stage:runTopLevelLifecycles Completed in 477ms
11 verbose stack SyntaxError: Unexpected end of JSON input while parsing near '...x","firebase":"~1.0.1'
11 verbose stack at JSON.parse (<anonymous>)
11 verbose stack at parseJson (/usr/local/lib/node_modules/npm/node_modules/json-parse-better-errors/index.js:7:17)
11 verbose stack at consumeBody.call.then.buffer (/usr/local/lib/node_modules/npm/node_modules/node-fetch-npm/src/body.js:96:50)
11 verbose stack at process._tickCallback (internal/process/next_tick.js:68:7)
12 verbose cwd /Users/techienimi
13 verbose Darwin 16.7.0
14 verbose argv "/usr/local/Cellar/node/10.10.0/bin/node" "/usr/local/bin/npm" "install" "-g" "firebase-tools"
15 verbose node v10.10.0
16 verbose npm v6.4.1
17 error Unexpected end of JSON input while parsing near '...x","firebase":"~1.0.1'
18 verbose exit [ 1, true ]
Based on these lines:
7 http fetch GET 304 https://registry.npmjs.org/firebase-tools 297ms (from cache)
8 silly fetchPackageMetaData error for firebase-tools#latest Unexpected end of JSON input while parsing near '...x","firebase":"~1.0.1'
It sounds like your npm cache might be corrupt. Try deleting the directory .npm in your home directory to reset it.
Or, you could try to run a command to reset the cache.
I am getting a 404 error when trying to link a local module with npm following the docs
Inside the local module directory seems like it creates a global link correctly:
$ npm link
/usr/local/lib/node_modules/my-module-name -> /Users/XXX/my-module-directory/my-module-name
But when just after that I try to link this from other project directory i get an 404 error:
$ npm link my-module-name
npm ERR! code E404
npm ERR! 404 Not Found: my-module-name#latest
I've tried to unlink the module and link again or change versions but it doesn't work.
Here is full log:
0 info it worked if it ends with ok
1 verbose cli [ '/Users/XXX/.nvm/versions/node/v8.2.1/bin/node',
1 verbose cli '/Users/XXX/.nvm/versions/node/v8.2.1/bin/npm',
1 verbose cli 'link',
1 verbose cli 'my-module-name' ]
2 info using npm#5.3.0
3 info using node#v8.2.1
4 verbose npm-session 7d82e8d8dc1bdc83
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 http fetch GET 404 https://registry.npmjs.org/my-module-name 2304ms
8 silly fetchPackageMetaData error for my-module-name#latest 404 Not Found: my-module-name#latest
9 verbose stack Error: 404 Not Found: my-module-name#latest
9 verbose stack at fetch.then.res (/Users/XXX/.nvm/versions/node/v8.2.1/lib/node_modules/npm/node_modules/pacote/lib/fetchers/registry/fetch.js:41:19)
9 verbose stack at tryCatcher (/Users/XXX/.nvm/versions/node/v8.2.1/lib/node_modules/npm/node_modules/bluebird/js/release/util.js:16:23)
9 verbose stack at Promise._settlePromiseFromHandler (/Users/XXX/.nvm/versions/node/v8.2.1/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:512:31)
9 verbose stack at Promise._settlePromise (/Users/XXX/.nvm/versions/node/v8.2.1/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:569:18)
9 verbose stack at Promise._settlePromise0 (/Users/XXX/.nvm/versions/node/v8.2.1/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:614:10)
9 verbose stack at Promise._settlePromises (/Users/XXX/.nvm/versions/node/v8.2.1/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:693:18)
9 verbose stack at Async._drainQueue (/Users/XXX/.nvm/versions/node/v8.2.1/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:133:16)
9 verbose stack at Async._drainQueues (/Users/XXX/.nvm/versions/node/v8.2.1/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:143:10)
9 verbose stack at Immediate.Async.drainQueues (/Users/XXX/.nvm/versions/node/v8.2.1/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:17:14)
9 verbose stack at runCallback (timers.js:781:20)
9 verbose stack at tryOnImmediate (timers.js:743:5)
9 verbose stack at processImmediate [as _immediateCallback] (timers.js:714:5)
10 verbose cwd /Users/XXX/my-project-directory
11 verbose Darwin 16.6.0
12 verbose argv "/Users/XXX/.nvm/versions/node/v8.2.1/bin/node" "/Users/XXX/.nvm/versions/node/v8.2.1/bin/npm" "link" "my-module-name"
13 verbose node v8.2.1
14 verbose npm v5.3.0
15 error code E404
16 error 404 Not Found: my-module-name#latest
17 verbose exit [ 1, true ]
You're using an NVM-installed version of Node.js to run npm link my-module-name, but you didn't run npm link (in your module's directory) using that same version.
The initial link is created in /usr/local/lib/node_modules, but when you use NVM, each Node.js version gets their own "lib" directory, in your example /Users/XXX/.nvm/versions/node/v8.2.1/lib/node_modules, which is a different directory.
I seem to be struggling with getting npm to install web3
Command used:
npm install web3
Error:
npm ERR! Path must be a string. Received undefined
Logs:
info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'install', 'web3' ]
2 info using npm#5.0.4
3 info using node#v8.1.3
4 verbose npm-session 02c74f27df35fda1
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 http fetch GET 304 https://registry.npmjs.org/web3 236ms (from cache)
8 silly pacote tag manifest for web3#latest fetched in 269ms
9 verbose stack TypeError: Path must be a string. Received undefined
9 verbose stack at assertPath (path.js:28:11)
9 verbose stack at Object.relative (path.js:1248:5)
9 verbose stack at computeVersionSpec (/usr/lib/node_modules/npm/lib/install/deps.js:282:27)
9 verbose stack at Installer.normalizeCurrentTree (/usr/lib/node_modules/npm/lib/install.js:370:69)
9 verbose stack at Array.<anonymous> (/usr/lib/node_modules/npm/node_modules/slide/lib/bind-actor.js:15:8)
9 verbose stack at LOOP (/usr/lib/node_modules/npm/node_modules/slide/lib/chain.js:15:14)
9 verbose stack at /usr/lib/node_modules/npm/node_modules/slide/lib/chain.js:18:7
9 verbose stack at iferr (/usr/lib/node_modules/npm/lib/install.js:328:5)
9 verbose stack at /usr/lib/node_modules/npm/node_modules/iferr/index.js:13:50
9 verbose stack at cb (/usr/lib/node_modules/npm/node_modules/slide/lib/async-map.js:47:24)
9 verbose stack at /usr/lib/node_modules/npm/node_modules/call-limit/call-limit.js:22:12
9 verbose stack at _combinedTickCallback (internal/process/next_tick.js:95:7)
9 verbose stack at process._tickCallback (internal/process/next_tick.js:161:9)
10 verbose cwd /home/username
11 verbose Linux 4.11.7-1-ARCH
12 verbose argv "/usr/bin/node" "/usr/bin/npm" "install" "web3"
13 verbose node v8.1.3
14 verbose npm v5.0.4
15 error Path must be a string. Received undefined
16 verbose exit [ 1, true ]
I've tried running them with root user as well.
The problem might come from using a beta version of web3 it's not stable at the moment and currently is under heavy development you have one of two options,
either use a stable version 0.19 I think or something like that.
Another thing I would suggest trying is npm --save in order to save the package locally in the project
Error Log info :
0 info it worked if it ends with ok
1 verbose cli [ 'C:\Program Files\nodejs\node.exe',
1 verbose cli 'C:\Users\wf70\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js',
1 verbose cli 'install',
1 verbose cli '--save-dev',
1 verbose cli 'webpack' ]
2 info using npm#5.0.1
3 info using node#v6.10.2
4 silly install loadCurrentTree
5 silly install readLocalPackageData
6 http fetch GET 400 https://registry.npmjs.org/webpack 238ms
7 silly fetchPackageMetaData error for webpack#latest 400 Bad Request ( The data is invalid. ): webpack#latest
8 verbose stack Error: 400 Bad Request ( The data is invalid. ): webpack#latest
8 verbose stack at fetch.then.res (C:\Users\wf70\AppData\Roaming\npm\node_modules\npm\node_modules\pacote\lib\fetchers\registry\fetch.js:36:19)
8 verbose stack at tryCatcher (C:\Users\wf70\AppData\Roaming\npm\node_modules\npm\node_modules\bluebird\js\release\util.js:16:23)
8 verbose stack at Promise._settlePromiseFromHandler (C:\Users\wf70\AppData\Roaming\npm\node_modules\npm\node_modules\bluebird\js\release\promise.js:512:31)
8 verbose stack at Promise._settlePromise (C:\Users\wf70\AppData\Roaming\npm\node_modules\npm\node_modules\bluebird\js\release\promise.js:569:18)
8 verbose stack at Promise._settlePromise0 (C:\Users\wf70\AppData\Roaming\npm\node_modules\npm\node_modules\bluebird\js\release\promise.js:614:10)
8 verbose stack at Promise._settlePromises (C:\Users\wf70\AppData\Roaming\npm\node_modules\npm\node_modules\bluebird\js\release\promise.js:693:18)
8 verbose stack at Async._drainQueue (C:\Users\wf70\AppData\Roaming\npm\node_modules\npm\node_modules\bluebird\js\release\async.js:133:16)
8 verbose stack at Async._drainQueues (C:\Users\wf70\AppData\Roaming\npm\node_modules\npm\node_modules\bluebird\js\release\async.js:143:10)
8 verbose stack at Immediate.Async.drainQueues (C:\Users\wf70\AppData\Roaming\npm\node_modules\npm\node_modules\bluebird\js\release\async.js:17:14)
8 verbose stack at runCallback (timers.js:666:20)
8 verbose stack at tryOnImmediate (timers.js:639:5)
8 verbose stack at processImmediate [as _immediateCallback] (timers.js:611:5)
9 verbose cwd D:\2017\ReactJSProject
10 verbose Windows_NT 6.1.7601
11 verbose argv "C:\Program Files\nodejs\node.exe" "C:\Users\wf70\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js" "install" "--save-dev" "webpack"
12 verbose node v6.10.2
13 verbose npm v5.0.1
14 error code E400
15 error 400 Bad Request ( The data is invalid. ): webpack#latest
16 verbose exit [ 1, true ]
Try the Below :
Option 1
Open Command prompt as admin
npm uninstall -g webpack#latest
npm cache clean
npm config set strict-ssl false
npm install -g webpack#latest
OR :
Option 2
Open Command prompt as admin
npm uninstall -g webpack#latest
npm cache clean
npm config set proxy="http://proxy.example.com:8080"
npm config set https-proxy="http://proxy.example.com:8080"
npm config set strict-ssl false
npm install -g webpack#latest
If you get the error reason: write EPROTO try,
npm config set proxy="http://proxy.example.com:8080"
npm config set https-proxy="http://proxy.example.com:8080"
Follow Option 2
If all the above fails try to install the latest stable version of node & npm.