Open mancioshell opened 5 years ago
We get the location of libnpx
from global-dirs. Can you please:
npm install global-dirs@1.0.0
somewherenode -e "console.log(require('global-dirs'))"
and paste the outputIt's ok, but probably you should specify in documentation that libnpx is required to be installed globally
node -e "console.log(require('global-dirs'))"
{ npm:
{ prefix: 'C:\\Users\\almancini\\AppData\\Roaming\\npm',
packages: 'C:\\Users\\almancini\\AppData\\Roaming\\npm\\node_modules',
binaries: 'C:\\Users\\almancini\\AppData\\Roaming\\npm' },
yarn:
{ prefix: 'C:\\Users\\almancini\\AppData\\Roaming\\npm',
packages:
'C:\\Users\\almancini\\AppData\\Roaming\\npm\\global\\node_modules',
binaries:
'C:\\Users\\almancini\\AppData\\Roaming\\npm\\global\\node_modules\\.bin' } }
If i install libnpx globally i haven't this error anymore.
In any case tool doesn't work because it doesn't found npm path:
C:\Users\almancini\provetta>npm init yo license
npx: installed 15 in 2.289s
ENOENT: no such file or directory, stat 'C:\Users\almancini\AppData\Roaming\npm\npm'
√ create-yo ok!
Have i to install also npm as global package even if i alreay have in my nodejs installation?
EDIT:
I have installed npm as global package, but now i have this error:
C:\Users\almancini\provetta>npm init yo license
npx: installed 15 in 2.256s
Command failed: C:\"Program Files"\nodejs\node.exe "C:\Users\almancini\AppData\Roaming\npm\npm" config get cache --parseable
C:\Users\almancini\AppData\Roaming\npm\npm:2
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
^^^^^^^
SyntaxError: missing ) after argument list
at Module._compile (internal/modules/cjs/loader.js:721:23)
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 Function.Module.runMain (internal/modules/cjs/loader.js:829:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
√ create-yo ok!
there are two problems here:
libnpx
should be pulled from local dir, if present.The problem is that on a regular Windows Node.js installation, globalDirs.npm.packages
points to:
C:\Users\dev\AppData\Roaming\npm\node_modules
.
Yet libnpx
is located in the Node.js installation directory at:
C:\Program Files\nodejs\node_modules\npm\node_modules\libnpx
So this line files importFrom(path.join(globalDirs.npm.packages, 'npm'), 'libnpx')
.
Not sure what a clean fix for this looks like.. since global-dirs
is correct in providing the directory for user installed global packages. Tested with globalDirs.npm.binaries
which also points to the user dir C:\Users\dev\AppData\Roaming\npm
.
It just works for me in Windows. I installed Node with choco install nodejs-lts
.
The problem occurs when using the official Node.js Windows installer
Hi All: I found a simple way with zero third-party packages to resolve Linux and Windows libnpx path.
It could be taken a chance to try.
https://github.com/react-atomic/reshow/blob/main/packages/yonpx/src/init.js#L5-L14
it's work for me on node13.
I have a fresh nodejs installation in Windows 10 (i have this issue in linux too)
I already verify npm cache:
If i try to use licence generator with npm init:
NodeJS and npm version: