foxhound87 / rfx-stack

RFX Stack - Universal App

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error running npm run web:dev on windows

dariuspranskus opened this issue · comments

Hi

When I try running your project web part on windows 10 machine I get the following error:

D:\DEV\react\rfx\node_modules\webpack-dev-middleware\middleware.js:106
                        if(err) throw err;
                                ^
 Error: invalid argument
    at pathToArray (D:\DEV\react\rfx\node_modules\memory-fs\lib\MemoryFileSystem.js:44:10)
    at MemoryFileSystem.mkdirpSync (D:\DEV\react\rfx\node_modules\memory-fs\lib\MemoryFileSystem.js:139:13)
    at MemoryFileSystem.(anonymous function) [as mkdirp] (D:\DEV\react\rfx\node_modules\memory-fs\lib\MemoryFileSystem.js:279:34)
    at Compiler.<anonymous> (D:\DEV\react\rfx\node_modules\webpack\lib\Compiler.js:229:25)
    at Compiler.applyPluginsAsync (D:\DEV\react\rfx\node_modules\tapable\lib\Tapable.js:60:69)
    at Compiler.emitAssets (D:\DEV\react\rfx\node_modules\webpack\lib\Compiler.js:226:7)
    at Watching.<anonymous> (D:\DEV\react\rfx\node_modules\webpack\lib\Compiler.js:54:18)
    at D:\DEV\react\rfx\node_modules\webpack\lib\Compiler.js:403:12
    at Compiler.next (D:\DEV\react\rfx\node_modules\tapable\lib\Tapable.js:67:11)
    at Compiler.<anonymous> (D:\DEV\react\rfx\node_modules\webpack\lib\CachePlugin.js:40:4)
    at Compiler.applyPluginsAsync (D:\DEV\react\rfx\node_modules\tapable\lib\Tapable.js:71:13)
    at Compiler.<anonymous> (D:\DEV\react\rfx\node_modules\webpack\lib\Compiler.js:400:9)
    at Compilation.<anonymous> (D:\DEV\react\rfx\node_modules\webpack\lib\Compilation.js:577:13)
    at Compilation.applyPluginsAsync (D:\DEV\react\rfx\node_modules\tapable\lib\Tapable.js:60:69)
    at Compilation.<anonymous> (D:\DEV\react\rfx\node_modules\webpack\lib\Compilation.js:572:10)
    at Compilation.applyPluginsAsync (D:\DEV\react\rfx\node_modules\tapable\lib\Tapable.js:60:69)
My npm-debug.log file is as follows:

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'run',
1 verbose cli   'web:dev' ]
2 info using npm@3.9.3
3 info using node@v6.2.1
4 verbose run-script [ 'preweb:dev', 'web:dev', 'postweb:dev' ]
5 info lifecycle rfx-stack@0.5.0-alpha.5~preweb:dev: rfx-stack@0.5.0-alpha.5
6 silly lifecycle rfx-stack@0.5.0-alpha.5~preweb:dev: no script for preweb:dev, continuing
7 info lifecycle rfx-stack@0.5.0-alpha.5~web:dev: rfx-stack@0.5.0-alpha.5
8 verbose lifecycle rfx-stack@0.5.0-alpha.5~web:dev: unsafe-perm in lifecycle true
9 verbose lifecycle rfx-stack@0.5.0-alpha.5~web:dev: PATH: C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin;D:\DEV\react\rfx\node_modules\.bin;C:\Program Files\nodejs;D:\Home\BAT\;d:\dev\tools\graphicsmagick;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files\Git\cmd;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Program Files (x86)\Skype\Phone\;C:\Program Files\Python2;C:\Users\dariu\.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm\;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;c:\Program Files\MongoDB\Server\3.2\bin\;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\Microsoft SQL Server\120\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\ManagementStudio\;C:\Program Files (x86)\Microsoft SQL Server\120\DTS\Binn\;C:\Program Files\nodejs\;C:\Program Files\cURL\bin;C:\Users\dariu\.dnx\bin;D:\DEV\Ruby\bin;C:\Users\dariu\AppData\Local\.meteor\;C:\Users\dariu\AppData\Local\atom\bin;C:\Program Files (x86)\Microsoft VS Code\bin;C:\Users\dariu\AppData\Roaming\npm
10 verbose lifecycle rfx-stack@0.5.0-alpha.5~web:dev: CWD: D:\DEV\react\rfx
11 silly lifecycle rfx-stack@0.5.0-alpha.5~web:dev: Args: [ '/d /s /c',
11 silly lifecycle   'SET NODE_ENV=development & node ./run/start.web.js' ]
12 silly lifecycle rfx-stack@0.5.0-alpha.5~web:dev: Returned: code: 1  signal: null
13 info lifecycle rfx-stack@0.5.0-alpha.5~web:dev: Failed to exec web:dev script
14 verbose stack Error: rfx-stack@0.5.0-alpha.5 web:dev: `SET NODE_ENV=development & node ./run/start.web.js`
14 verbose stack Exit status 1
14 verbose stack     at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:245:16)
14 verbose stack     at emitTwo (events.js:106:13)
14 verbose stack     at EventEmitter.emit (events.js:191:7)
14 verbose stack     at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:24:14)
14 verbose stack     at emitTwo (events.js:106:13)
14 verbose stack     at ChildProcess.emit (events.js:191:7)
14 verbose stack     at maybeClose (internal/child_process.js:852:16)
14 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:5)
15 verbose pkgid rfx-stack@0.5.0-alpha.5
16 verbose cwd D:\DEV\react\rfx
17 error Windows_NT 10.0.10586
18 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "web:dev"
19 error node v6.2.1
20 error npm  v3.9.3
21 error code ELIFECYCLE
22 error rfx-stack@0.5.0-alpha.5 web:dev: `SET NODE_ENV=development & node ./run/start.web.js`
22 error Exit status 1
23 error Failed at the rfx-stack@0.5.0-alpha.5 web:dev script 'SET NODE_ENV=development & node ./run/start.web.js'.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the rfx-stack package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error     SET NODE_ENV=development & node ./run/start.web.js
23 error You can get information on how to open an issue for this project with:
23 error     npm bugs rfx-stack
23 error Or if that isn't available, you can get their info via:
23 error     npm owner ls rfx-stack
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]

api part starts fine. What might be a problem

Many thanks.

I didn't used the stack on a window machine. However I don't know if this issue it's related to the OS.
But certainly is related to the webpack-dev-middleware package, and it's similar to these issues:

I think you should ask there.

But first, you can try to edit the output.path of /webpack/config.client.dev.js:

from:

output: {
   path: '/',
   ...

to:

output: {
   path: path.join(Dir.public, 'build'),
   ...

If path.join() don't work either, try with path.resolve().

let me know if this worked.

Thanks @foxhound87, I tried that, but it did not help. I tried also to put a line like

export function config() {
  console.log(path.join(Dir.public, 'build'));

and I see no output. It is like it's breaking somewhere before it hits that line. But I run launched an Ubuntu VM will try there.

The webpack config file is loaded from the hot-middleware in /src/web/middleware/hot.js using babel-root-import:

import config from '~/webpack.config.babel';

so I think ther's something still not working on the babel-root-import with the Windows-Filesystem support:
https://github.com/michaelzoidl/babel-root-import/issues?utf8=%E2%9C%93&q=window

I suggest to remove the package and replace all the imports from '~/ with the relative real path.

...or try one of these packages instead:

@dariuspranskus let me know if you fixed it

@dariuspranskus this issue can be caused also by the node env vars, consider using this for cross platform support: https://www.npmjs.com/package/cross-env

I have the same issue on Windows 10. And I also tried the cross-env, still not working.

@FerminYang Thank you for your hint.

so the problem was in webpack.config.babel in windows, match.script is not matching the npm script name, so I replaced the function with process.env.npm_lifecycle_event === "web:dev" and got passed the error, but then I got

C:\Users\rickm\Documents\Google Drive\Projects\NodeJS\rfx-stack\src\shared\app.js:34
var uri = ['http://', config.io.host, ':', config.io.port].join('');
^

TypeError: Cannot read property 'io' of undefined

and got tired of debugging :)

EDIT: ookaayyy gave it another shot and there was indeed cross OS env shenanigans going on so I installed cross-env and change package.json to "web:dev": "cross-env NODE_ENV=development node ./run/start.web.js"

and it worked (I'm on win 10), cheers

@rickmed please, can you test the last commit on windows? I made some changes, still using the match.script() but I changed the implementation. That's a very strange behavior.

@rickmed thank you for your support! issue closed! 4c139ea