Unable to install npm packages into nativescript project (..after installing nativescript-nodeify?)

Viewed 441

I'm encountering a problem which gives me headache for hours already. I am working on a mobile app which I am developing in a nativescript environment. As my app needs to decode JSON Web Tokens for login purposes I tried to install the npm jsonwebtoken-package, which seems not to be compatible with nativescript. After some google I found the 'nativescript-nodeify'-plugin which I installed via

tns plugin add nativescript-nodeify

After that everything seemed to work fine but later on I tried to install another package, which gave me the following error:

npm ERR! code EINVALIDPACKAGENAME
npm ERR! Invalid package name "nativescript-nodeify/node_modules/string_decoder": name can only contain URL-friendly characters

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/jonas/.npm/_logs/2017-10-06T16_24_33_241Z-debug.log

This is the content of the log-file:

0 info it worked if it ends with ok
1 verbose cli [ '/home/jonas/.nvm/versions/node/v6.11.3/bin/node',
1 verbose cli   '/home/jonas/.nvm/versions/node/v6.11.3/bin/npm',
1 verbose cli   'install',
1 verbose cli   'file-system',
1 verbose cli   '--save' ]
2 info using npm@5.4.2
3 info using node@v6.11.3
4 verbose npm-session d7333b71d2cd0141
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 http fetch GET 304 https://registry.npmjs.org/file-system 216ms (from cache)
8 silly pacote tag manifest for file-system@latest fetched in 238ms
9 silly install loadIdealTree
10 silly install cloneCurrentTreeToIdealTree
11 silly install loadShrinkwrap
12 silly install loadAllDepsIntoIdealTree
13 silly resolveWithNewModule file-system@2.2.2 checking installable status
14 http fetch GET 304 https://registry.npmjs.org/utils-extend 164ms (from cache)
15 silly pacote range manifest for utils-extend@^1.0.4 fetched in 166ms
16 silly resolveWithNewModule utils-extend@1.0.8 checking installable status
17 http fetch GET 304 https://registry.npmjs.org/file-match 171ms (from cache)
18 silly pacote range manifest for file-match@^1.0.1 fetched in 172ms
19 silly resolveWithNewModule file-match@1.0.2 checking installable status
20 verbose stack Error: Invalid package name "nativescript-nodeify/node_modules/string_decoder": name can only contain URL-friendly characters
20 verbose stack     at invalidPackageName (/home/jonas/.nvm/versions/node/v6.11.3/lib/node_modules/npm/node_modules/npm-package-arg/npa.js:71:15)
20 verbose stack     at Object.Result.setName (/home/jonas/.nvm/versions/node/v6.11.3/lib/node_modules/npm/node_modules/npm-package-arg/npa.js:107:11)
20 verbose stack     at Object.Result (/home/jonas/.nvm/versions/node/v6.11.3/lib/node_modules/npm/node_modules/npm-package-arg/npa.js:96:23)
20 verbose stack     at Function.resolve (/home/jonas/.nvm/versions/node/v6.11.3/lib/node_modules/npm/node_modules/npm-package-arg/npa.js:45:15)
20 verbose stack     at childDependencySpecifier (/home/jonas/.nvm/versions/node/v6.11.3/lib/node_modules/npm/lib/install/deps.js:81:14)
20 verbose stack     at addDependency (/home/jonas/.nvm/versions/node/v6.11.3/lib/node_modules/npm/lib/install/deps.js:532:15)
20 verbose stack     at /home/jonas/.nvm/versions/node/v6.11.3/lib/node_modules/npm/lib/install/deps.js:482:5
20 verbose stack     at /home/jonas/.nvm/versions/node/v6.11.3/lib/node_modules/npm/node_modules/slide/lib/async-map.js:52:35
20 verbose stack     at Array.forEach (native)
20 verbose stack     at /home/jonas/.nvm/versions/node/v6.11.3/lib/node_modules/npm/node_modules/slide/lib/async-map.js:52:11
20 verbose stack     at Array.forEach (native)
20 verbose stack     at asyncMap (/home/jonas/.nvm/versions/node/v6.11.3/lib/node_modules/npm/node_modules/slide/lib/async-map.js:51:8)
20 verbose stack     at loadDeps (/home/jonas/.nvm/versions/node/v6.11.3/lib/node_modules/npm/lib/install/deps.js:474:3)
20 verbose stack     at Array.<anonymous> (/home/jonas/.nvm/versions/node/v6.11.3/lib/node_modules/npm/node_modules/slide/lib/bind-actor.js:15:8)
20 verbose stack     at LOOP (/home/jonas/.nvm/versions/node/v6.11.3/lib/node_modules/npm/node_modules/slide/lib/chain.js:15:14)
20 verbose stack     at /home/jonas/.nvm/versions/node/v6.11.3/lib/node_modules/npm/node_modules/slide/lib/chain.js:18:7
21 verbose cwd /home/jonas/Dokumente/Telemedizin-Bachelorarbeit-JF/medicalIM
22 verbose Linux 4.4.0-42-generic
23 verbose argv "/home/jonas/.nvm/versions/node/v6.11.3/bin/node" "/home/jonas/.nvm/versions/node/v6.11.3/bin/npm" "install" "file-system" "--save"
24 verbose node v6.11.3
25 verbose npm  v5.4.2
26 error code EINVALIDPACKAGENAME
27 error Invalid package name "nativescript-nodeify/node_modules/string_decoder": name can only contain URL-friendly characters
28 verbose exit [ 1, true ]

I tried to uninstall nativescript-nodeify via

tns plugin remove nativescript-nodeify

which seems also to use the npm-command and fails:

Command failed: npm uninstall nativescript-nodeify --save
npm ERR! code EINVALIDPACKAGENAME
npm ERR! Invalid package name "util/util.js": name can only contain URL-friendly characters

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/jonas/.npm/_logs/2017-10-06T16_01_14_047Z-debug.log

I went back a few commits (before I installed nodeify) and the npm install command works as expected.

As I need these packages in my project, it would be awesome if somebody has got a solution to get nativescript-nodeify working properly or an alternative to it.

Thank you in advance ;)

1 Answers
Related