[Pkg-javascript-devel] Bug#933862: Bug#933862: nodepath does not work with grunt plugins

Xavier yadd at debian.org
Sun Aug 4 15:17:16 BST 2019


Le 04/08/2019 à 16:07, Xavier a écrit :
> Le 04/08/2019 à 15:59, Pirate Praveen a écrit :
>> Package: pkg-js-tools
>> version: 0.8.10
>>
>> Example package, node-handlebars
>>
>> ln -s `nodepath grunt-webpack` node_modules
>> internal/modules/cjs/loader.js:583
>>     throw err;
>>     ^
>>
>> Error: Cannot find module 'grunt-webpack'
>>     at Function.Module._resolveFilename
>> (internal/modules/cjs/loader.js:581:15)
>>     at Function.resolve (internal/modules/cjs/helpers.js:32:19)
>>     at [eval]:1:21
>>     at Script.runInThisContext (vm.js:96:20)
>>     at Object.runInThisContext (vm.js:303:38)
>>     at Object.<anonymous> ([eval]-wrapper:6:22)
>>     at Module._compile (internal/modules/cjs/loader.js:689:30)
>>     at evalScript (internal/bootstrap/node.js:587:27)
>>     at startup (internal/bootstrap/node.js:265:9)
>>     at bootstrapNodeJSCore (internal/bootstrap/node.js:743:3)
>> ln: failed to create symbolic link './node_modules': File exists
> 
> This means that node-grunt-webpack is broken: package.json has no "main"
> entry and index.js is missing. How to fix that ?
> 
> 
> $ node -e 'require("grunt-webpack")'
> internal/modules/cjs/loader.js:583
>     throw err;
>     ^
> 
> Error: Cannot find module 'grunt-webpack'
>     at Function.Module._resolveFilename
> (internal/modules/cjs/loader.js:581:15)
>     at Function.Module._load (internal/modules/cjs/loader.js:507:25)
>     at Module.require (internal/modules/cjs/loader.js:637:17)
>     at require (internal/modules/cjs/helpers.js:22:18)
>     at [eval]:1:1
>     at Script.runInThisContext (vm.js:96:20)
>     at Object.runInThisContext (vm.js:303:38)
>     at Object.<anonymous> ([eval]-wrapper:6:22)
>     at Module._compile (internal/modules/cjs/loader.js:689:30)
>     at evalScript (internal/bootstrap/node.js:587:27)

A way found:

--- a/tools/nodepath
+++ b/tools/nodepath
@@ -41,7 +41,10 @@ for d in /usr/share/nodejs /usr/lib/nodejs
/usr/lib/*/nodejs; do
                NFILE="$NFILE $d"
        fi
 done
-FILE=`node -e "console.log(require.resolve('$MODULE'))"|perl -pe
's/(nodejs\/[^\/]*)(\/.*)?$/$1/'`
+FILE=`(node -e
"console.log(require.resolve('$MODULE'+'/package.json'))" 2>/dev/null ||
true) | perl -pe 's/(nodejs\/[^\/]*)(\/.*)?$/$1/'`
+if [ "$FILE" == "" ]; then
+       FILE=`node -e "console.log(require.resolve('$MODULE'))"|perl -pe
's/(nodejs\/[^\/]*)(\/.*)?$/$1/'`
+fi
 if test "$PACKAGE" = "1"; then
        if test $PACKAGEONLY = 1; then
                dpkg -S $FILE|sed -e 's/:.*//'



More information about the Pkg-javascript-devel mailing list