Not choosing task
john-cheesman opened this issue ยท 9 comments
I have the following scripts setup:
"scripts": {
"start": "per-env",
"start:development": "npm run build:development",
"start:production": "npm run build:production",
"clean-styles": "rimraf web/css && mkdirp web/css",
"build": "per-env",
"build:development": "npm run styles:development",
"build:production": "npm run styles:production",
"prestyles": "per-env",
"prestyles:development": "npm run clean-styles",
"prestyles:production": "npm run clean-styles",
"styles": "per-env",
"styles:development": "node-sass src/sass/main.scss | postcss -u autoprefixer > web/css/style.css",
"styles:production": "node-sass src/sass/main.scss | postcss -u autoprefixer | cleancss > web/css/style.css"
}
When I run npm start
I just get the output showing per-env
is running and then it finishes before going to the next task.
I've tried using the example setup from the readme but I'm getting the same issue. I'm running this on Windows 10, I haven't tried on a Mac yet.
@john-cheesman Can you run try it on your Mac? I've only used that & confirmed that the pattern you're using works fine. (That's how we use per-env
ourselves at work)
It's working fine on my Mac, must be a Windows issue then. It's not throwing an error though, just fails to get the next task.
I did some debugging and discovered that spawnSync
was failing silently and looks like the same as this issue: nodejs/node-v0.x-archive#25330
I tried changing the command variable to "npm.cmd"
and it did then run through the tasks but with all of them causing MODULE_NOT_FOUND Cannot find module 'undefined'
errors.
Got the same pattern on Windows.
spawnSync fails with Error: spawnSync npm ENOENT.
I have experienced the same on windows, and the "FIX on windows" - #10 seems to work! An update to the module would be cool..
The fix is to check whether node is running on window, if yes then spawnSync('npm.cmd' ...)
if no spawnSync('npm' ...)
, so I was wondering if introducing https://www.npmjs.com/package/cross-spawn over-skilled?
It doesn't work on windows 10. Are you planning to update the library to support windows?
I think cross-spawn
is the way to go. I don't have a Windows development machine (just for gaming!), but it's probably easy to get #10 passing again.
Free publisher/contributor rights to whoever wants it ๐
@ericclemmons hi it seems no one does that so I just created a pull request for it using cross-spawn
. I test on window, no extensively though, but the change is simple.