You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When I try to run the generated project using Ubuntu on WSL, there is syntax error on the line "#!/usr/bin/env node" in server.js file.
To Reproduce
Steps to reproduce the behavior:
Create a WTS project with React and Express
Open Ubuntu WSL
Run "npm install" to install the dependencies
Run "npm start"
The error comes up
Expected behavior
No error expected
Additional context
This is the error I got:
[1] > myapp@0.1.0 start-backend /mnt/d/Visual Studio Code Projects/myApp/myApp
[1] > node server/server.js
[1]
[1] /mnt/d/Visual Studio Code Projects/myApp/myApp/server/server.js:1
[1] #!/usr/bin/env node
[1] ^
[1]
[1] SyntaxError: Invalid or unexpected token
[1] at wrapSafe (internal/modules/cjs/loader.js:1067:16)
[1] at Module._compile (internal/modules/cjs/loader.js:1115:27)
[1] at Object.Module._extensions..js (internal/modules/cjs/loader.js:1171:10)
[1] at Module.load (internal/modules/cjs/loader.js:1000:32)
[1] at Function.Module._load (internal/modules/cjs/loader.js:899:14)
[1] at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
[1] at internal/main/run_main_module.js:17:47
[1] npm ERR! code ELIFECYCLE
[1] npm ERR! errno 1
[1] npm ERR! myapp@0.1.0 start-backend: node server/server.js
[1] npm ERR! Exit status 1
[1] npm ERR!
[1] npm ERR! Failed at the myapp@0.1.0 start-backend script.
[1] npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
[1]
[1] npm ERR! A complete log of this run can be found in:
[1] npm ERR! /home/user/.npm/_logs/2020-03-01T15_04_48_052Z-debug.log
[1] yarn start-backend || npm run start-backend exited with code 1
System
VS Code Version: 1.42.1 (user setup)
WebTS Wizard Version: 0.2.2005803
WebTS Template Version: 0.2.20058.3
OS: Ubuntu 18.04.4 LTS using WSL on Windows 10 build 18363.693
Node Version: 13.9.0
The text was updated successfully, but these errors were encountered:
The problem is that server.js file is UTF8 with BOM encoded, which is causing the problem in WSL. You can remove this line and the server should start fine as the start command already specifies node.
Hi,
Just change the encoding of server.js file to UTF8 (instead of UTF-8 with BOM) and LF end of line.
Shebang is pretty usefull on linux, so I think it should stay there.
Hi @miradontsoa, we need UTF-8 with BOM for language support.
Also, the express generator doen't include a shebang and the package.json specifies to start the server using node, thats why we decided to remove it.
Describe the bug
When I try to run the generated project using Ubuntu on WSL, there is syntax error on the line "#!/usr/bin/env node" in server.js file.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
No error expected
Additional context
This is the error I got:
[1] > myapp@0.1.0 start-backend /mnt/d/Visual Studio Code Projects/myApp/myApp
[1] > node server/server.js
[1]
[1] /mnt/d/Visual Studio Code Projects/myApp/myApp/server/server.js:1
[1] #!/usr/bin/env node
[1] ^
[1]
[1] SyntaxError: Invalid or unexpected token
[1] at wrapSafe (internal/modules/cjs/loader.js:1067:16)
[1] at Module._compile (internal/modules/cjs/loader.js:1115:27)
[1] at Object.Module._extensions..js (internal/modules/cjs/loader.js:1171:10)
[1] at Module.load (internal/modules/cjs/loader.js:1000:32)
[1] at Function.Module._load (internal/modules/cjs/loader.js:899:14)
[1] at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
[1] at internal/main/run_main_module.js:17:47
[1] npm ERR! code ELIFECYCLE
[1] npm ERR! errno 1
[1] npm ERR! myapp@0.1.0 start-backend:
node server/server.js
[1] npm ERR! Exit status 1
[1] npm ERR!
[1] npm ERR! Failed at the myapp@0.1.0 start-backend script.
[1] npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
[1]
[1] npm ERR! A complete log of this run can be found in:
[1] npm ERR! /home/user/.npm/_logs/2020-03-01T15_04_48_052Z-debug.log
[1] yarn start-backend || npm run start-backend exited with code 1
System
The text was updated successfully, but these errors were encountered: