Comments (9)
What version of node?
from npm-run.
Node.js v9.7.1
Windows 7 x64
from npm-run.
Ok so I had to pull the execSync polyfill due to a security issue reported in #16, will have to look into alternatives for windows, at least getting this running on the cli. Apologies, for windows I recommend continuing to use 4.x for now.
from npm-run.
Feel free to do some investigation and send a PR, might be a few days until I get around to looking at it.
from npm-run.
I think that on Windows, only executables (.exe) are spawn-able without extension name. Here is a test script:
async function test() {
const {spawn} = require("child_process");
const eventToPromise = require("event-to-promise");
let p;
p = spawn("where", ["web-ext"], {stdio: "inherit"});
await eventToPromise(p, "exit");
p = spawn("where.exe", ["web-ext"], {stdio: "inherit"});
await eventToPromise(p, "exit");
p = spawn("web-ext", ["--version"], {stdio: "inherit"});
try {
await eventToPromise(p, "exit");
} catch (err) {
console.log("spawn error", err);
}
p = spawn("web-ext.cmd", ["--version"], {stdio: "inherit"});
await eventToPromise(p, "exit");
p = spawn("web-ext", ["--version"], {stdio: "inherit", shell: true});
await eventToPromise(p, "exit");
p = spawn("web-ext", ["--version"], {stdio: "inherit", shell: true, env: {pathext: ";"}});
try {
await eventToPromise(p, "exit");
} catch (err) {
console.log("spawn error", err);
}
}
test();
C:\Users\Owner\AppData\Roaming\npm\web-ext
C:\Users\Owner\AppData\Roaming\npm\web-ext.cmd
C:\Users\Owner\AppData\Roaming\npm\web-ext
C:\Users\Owner\AppData\Roaming\npm\web-ext.cmd
spawn error { Error: spawn web-ext ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:201:19)
at onErrorNT (internal/child_process.js:379:16)
at process._tickCallback (internal/process/next_tick.js:114:19)
errno: 'ENOENT',
code: 'ENOENT',
syscall: 'spawn web-ext',
path: 'web-ext',
spawnargs: [ '--version' ] }
2.6.0
2.6.0
'web-ext' 不是內部或外部命令、可執行的程式或批次檔。
To correctly spawn a .cmd
file, we have to use the full name, or invokes it through the shell that relies on environment variable pathext
.
Also note that, by spawning through shell, even the command isn't found, the child process (the shell process i.e. cmd.exe) is spawned successfully.
I would like to add options.shell = true
here:
Lines 54 to 61 in 03d91cb
What do you think?
from npm-run.
I am too facing the same issue.
Posting the error log here.
> [email protected] build-html:ecart-static-ui C:\Users\Lakky69\ecart\dev-tools\api-doc
> npm-run raml2html ecart-static-ui/index.raml -o dist/ecart-static-ui.html
Error: spawn raml2html ENOENT
at exports._errnoException (util.js:1020:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:197:32)
at onErrorNT (internal/child_process.js:376:16)
at _combinedTickCallback (internal/process/next_tick.js:80:11)
at process._tickCallback (internal/process/next_tick.js:104:9)
at Module.runMain (module.js:606:11)
at run (bootstrap_node.js:389:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:502:3
npm ERR! code ELIFECYCLE
npm ERR! errno 4294963238
npm ERR! [email protected] build-html:ecart-static-ui: `npm-run raml2html ecart-static-ui/index.raml -o dist/ecart-static-ui.html`
npm ERR! Exit status 4294963238
npm ERR!
npm ERR! Failed at the [email protected] build-html:ecart-static-ui script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Lakky69\AppData\Roaming\npm-cache\_logs\2018-04-20T09_43_34_743Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 4294963238
npm ERR! [email protected] build:ecart-static-ui: `npm run build-html:ecart-static-ui && npm run build-md:ecart-static-ui`
npm ERR! Exit status 4294963238
npm ERR!
npm ERR! Failed at the [email protected] build:ecart-static-ui script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Lakky69\AppData\Roaming\npm-cache\_logs\2018-04-20T09_43_34_806Z-debug.log
from npm-run.
@eight04 so hang on, does adding shell: true
fix the issue?
from npm-run.
@timoxley Yes, it does.
diff --git a/index.js b/index.js
index c7925c6..5d79520 100644
--- a/index.js
+++ b/index.js
@@ -57,6 +57,7 @@ function augmentOptionsSync (options) {
var env = Object.create(options.env)
env[npmPath.PATH] = newPath
options.env = env
+ options.shell = true
return options
}
D:\Dev\webextension-test>npm-run --version
5.0.1
D:\Dev\webextension-test>npm-run web-ext --version
2.6.0
Also the test failed on Windows:
D:\Dev\npm-run>npm test
> [email protected] test D:\Dev\npm-run
> tape test/*.js && npm run lint
TAP version 13
# bin ok
ok 1 should be truthy
ok 2 bin exists: D:\Dev\npm-run\bin\npm-run.js
# passing dashed args
internal/child_process.js:330
throw errnoException(err, 'spawn');
^
Error: spawn UNKNOWN
at ChildProcess.spawn (internal/child_process.js:330:11)
at exports.spawn (child_process.js:500:9)
at Test.<anonymous> (D:\Dev\npm-run\test\bin.js:26:15)
at Test.bound [as _cb] (D:\Dev\npm-run\node_modules\tape\lib\test.js:77:32)
at Test.run (D:\Dev\npm-run\node_modules\tape\lib\test.js:96:10)
at Test.bound [as run] (D:\Dev\npm-run\node_modules\tape\lib\test.js:77:32)
at Immediate.next (D:\Dev\npm-run\node_modules\tape\lib\results.js:71:15)
at runCallback (timers.js:763:18)
at tryOnImmediate (timers.js:734:5)
at processImmediate (timers.js:716:5)
npm ERR! Test failed. See above for more details.
from npm-run.
Any ideas on this one? I can support in pushing this forward.
from npm-run.
Related Issues (13)
- Why is this so much simpler than npm/npm#4058? HOT 2
- Doesn't work on Windows 10 ? HOT 3
- Upvote the answer on the StackOverflow question HOT 4
- Node Security Advisory violation HOT 1
- Cannot find module 'cross-spawn' HOT 1
- Dashed parameters are not passed HOT 2
- Run from a sub-directory
- Security: Tmp files readable by other users HOT 1
- cooles tool
- Local eslint doesn't work HOT 2
- Remove spawn-sync dep HOT 3
- bug: options is not optional HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from npm-run.