Angular-RU / angular-cli-webpack

Webpack configuration modifier for @angular/cli
MIT License
67 stars 5 forks source link

Error running in a folder with space characters #23

Closed ccaodiug closed 6 years ago

ccaodiug commented 6 years ago

Hi

I'm facing an issue when running ngw in a windows 10 environment (didn't try other OS) and having the full path of my repository that contains a folder with a space character in its name. Changing the folder name it works as expected but this is a little bit annoying. The error message is below.

Not working folder C:\Users\myuser\Documents\myfolder\GIT Repos\myrepo

Working folder path C:\Users\myuser\Documents\myfolder\GITRepos\myrepo

module.js:549
    throw err;
    ^

Error: Cannot find module 'C:\Users\myuser\Documents\myfolder\GIT'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Function.Module.runMain (module.js:693:10)
    at startup (bootstrap_node.js:188:16)
    at bootstrap_node.js:609:3
child_process.js:644
    throw err;
    ^

Error: Command failed: node C:\Users\myuser\Documents\myfolder\GIT Repos\myrepo\node_modules\ngw\node_modules\ts-node\dist\bin.js C:\Users\myuser\Documents\myfolder\GIT Repos\myrepo\node_modules\ngw\lib\index.js build --aot=true --base-href=/app/
    at checkExecSyncError (child_process.js:601:13)
    at execSync (child_process.js:641:13)
    at Object.<anonymous> (C:\Users\myuser\Documents\myfolder\GIT Repos\myrepo\node_modules\ngw\bin\ngw:14:9)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Function.Module.runMain (module.js:693:10)
    at startup (bootstrap_node.js:188:16)
splincode commented 6 years ago

Please add repo for reproduce or minimal introduction step

ccaodiug commented 6 years ago

I'm having the issue running ngw build --aot=true in any repo on my pc that is located in a folder structure with at least one space character. I think it is not repo content dependent. The issue appears at ngw start.

ivanpadavan commented 6 years ago

node_modules/ngw/bin/ngw Can you please change https://github.com/Angular-RU/angular-cli-webpack/blob/d5378718d69cd4c9898ee5e0720d5548a2cd47d7/bin/ngw#L14 to execSync(`node "${executionPoint}"`, {stdio: 'inherit'}); (add patherensis)

and tell us - does it close the issue?

ccaodiug commented 6 years ago

Thanks ivanpadavan,

your suggestion didn't fix the error but it is little bit changed. I think you got the problem:

module.js:549
    throw err;
    ^

Error: Cannot find module 'C:\Users\myuser\Documents\myfolder\GIT Repos\myrepo\node_modules\ngw\node_modules\ts-node\dist\bin.js C:\Users\myuser\Documents\myfolder\GIT Repos\myrepo\node_modules\ngw\lib\index.js build --aot=true --base-href=\app'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Function.Module.runMain (module.js:693:10)
    at startup (bootstrap_node.js:188:16)
    at bootstrap_node.js:609:3
child_process.js:644
    throw err;
    ^

Error: Command failed: node "C:\Users\myuser\Documents\myfolder\GIT Repos\myrepo\node_modules\ngw\node_modules\ts-node\dist\bin.js C:\Users\myuser\Documents\myfolder\GIT Repos\myrepo\node_modules\ngw\lib\index.js build --aot=true --base-href=/app/"
    at checkExecSyncError (child_process.js:601:13)
    at execSync (child_process.js:641:13)
    at Object.<anonymous> (C:\Users\myuser\Documents\myfolder\GIT Repos\myrepo\node_modules\ngw\bin\ngw:14:9)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Function.Module.runMain (module.js:693:10)
    at startup (bootstrap_node.js:188:16)
ccaodiug commented 6 years ago

I think i got a solution changing line 12 of node_modules/ngw/bin/ngw

from const executionPoint = [tsNodePath, entryPointPath].concat(ngCommandArgs).join(' ');

to const executionPoint = '"'+[tsNodePath, entryPointPath].concat(ngCommandArgs).join('" "')+'"';

ivanpadavan commented 6 years ago

Commit history is kinda messed up, should be cleaned in the future. I've made fixes. @ccaodiug can you please confirm that in new version (6.0.8) everything working as excepted on windows?

ccaodiug commented 6 years ago

Hi @ivanpadavan, yes it do. Thanks