Skip to content
This repository has been archived by the owner on Apr 7, 2021. It is now read-only.

ENOLOCAL when npm-cache path contains spaces on windows #6

Open
Stabilostick opened this issue Sep 5, 2019 · 2 comments
Open

ENOLOCAL when npm-cache path contains spaces on windows #6

Stabilostick opened this issue Sep 5, 2019 · 2 comments

Comments

@Stabilostick
Copy link

Stabilostick commented Sep 5, 2019

If spaces are in the path to npm-cache on windows you always get the following error when executing npx:

C:\dev\adapter>npx @iobroker/create-adapter
npm ERR! code ENOLOCAL
npm ERR! Could not install from "Files\iobroker\SmartHome17\env\npm-cache\_npx\2772" as it does not contain a package.json file.

In this case the path to npm-cache was 'C:\Program Files\iobroker\SmartHome17\env\npm-cache'.

More logging:

1 verbose cli [ 'C:\\Program Files\\iobroker\\SmartHome17\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\iobroker\\SmartHome17\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'install',
1 verbose cli   '@iobroker/create-adapter@latest',
1 verbose cli   '--global',
1 verbose cli   '--prefix',
1 verbose cli   'C:\\Program',
1 verbose cli   'Files\\iobroker\\SmartHome17\\env\\npm-cache\\_npx\\8336',
2 info using [email protected]
3 info using [email protected]
7 silly fetchPackageMetaData error for file:Files\iobroker\SmartHome17\env\npm-cache\_npx\8336 Could not install from "Files\iobroker\SmartHome17\env\npm-cache\_npx\8336" as it does not contain a package.json file.
12 verbose stack Error: ENOENT: no such file or directory, open 'C:\dev\adapter\Files\iobroker\SmartHome17\env\npm-cache\_npx\8336\package.json'
14 verbose Windows_NT 10.0.17134
15 verbose argv "C:\\Program Files\\iobroker\\SmartHome17\\nodejs\\node.exe" "C:\\Program Files\\iobroker\\SmartHome17\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "@iobroker/create-adapter@latest" "--global" "--prefix" "C:\\Program" "Files\\iobroker\\SmartHome17\\env\\npm-cache\\_npx\\8336" "--loglevel" "error" "--json"

NOTE: Because the child.spawn npm always runs in shell mode when on Windows (it's the default, to prevent weird behavior). That means that arguments to npm need to be escaped (but as strings, not as paths).
The regular unix invocation doesn't need escaping, because it doesn't run in shell mode.

Some releated npx issues:
zkat/npx#146 - workaround, not solved, closed
zkat/npx#100 - open, since July 2017
zkat/npx#223 - open, is npx project dead?

Solution:
zkat/npx#181 - open since May 2018

@ariccio
Copy link

ariccio commented Nov 9, 2020

Apparently nobody is working on that PR >:(

@ljharb
Copy link

ljharb commented Nov 10, 2020

This repo is largely dead, since its functionality now exists directly in npm 7, as npm exec (aliased to npx).

I’d try npm 7, and file an issue on the cli repo if it’s still a problem.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants