neutralinojs / neutralinojs-cli

neu cli for Neutralinojs
https://neutralino.js.org/docs/cli/neu-cli
MIT License
91 stars 57 forks source link

Syntax error while running neu command #184

Closed SmartyGrasshopper closed 2 years ago

SmartyGrasshopper commented 2 years ago

I encountered Syntax Error while using the neu command on Linux/PopOS Here are the errors that I encountered -

a@-popos-desktop:~$ neu /usr/local/lib/node_modules/@neutralinojs/neu/src/utils.js:42 return path?.replace(/^\//, ''); ^

SyntaxError: Unexpected token . at Module._compile (internal/modules/cjs/loader.js:723:23) at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10) at Module.load (internal/modules/cjs/loader.js:653:32) at tryModuleLoad (internal/modules/cjs/loader.js:593:12) at Function.Module._load (internal/modules/cjs/loader.js:585:3) at Module.require (internal/modules/cjs/loader.js:692:17) at require (internal/modules/cjs/helpers.js:25:18) at Object. (/usr/local/lib/node_modules/@neutralinojs/neu/src/modules/downloader.js:7:15) at Module._compile (internal/modules/cjs/loader.js:778:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10) at Module.load (internal/modules/cjs/loader.js:653:32) at tryModuleLoad (internal/modules/cjs/loader.js:593:12) at Function.Module._load (internal/modules/cjs/loader.js:585:3) at Module.require (internal/modules/cjs/loader.js:692:17) at require (internal/modules/cjs/helpers.js:25:18) at Object. (/usr/local/lib/node_modules/@neutralinojs/neu/src/modules/creator.js:4:20)

Then I removed that ? and rebuilt using - npm rebuild -g @neutralino/neu And got this error -

a@-popos-desktop:~$ neu /usr/local/lib/node_modules/@neutralinojs/neu/src/modules/filewatcher.js:30 if(configObj?.cli?.autoReloadExclude) { ^

SyntaxError: Unexpected token . at Module._compile (internal/modules/cjs/loader.js:723:23) at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10) at Module.load (internal/modules/cjs/loader.js:653:32) at tryModuleLoad (internal/modules/cjs/loader.js:593:12) at Function.Module._load (internal/modules/cjs/loader.js:585:3) at Module.require (internal/modules/cjs/loader.js:692:17) at require (internal/modules/cjs/helpers.js:25:18) at Object. (/usr/local/lib/node_modules/@neutralinojs/neu/src/commands/run.js:1:21) at Module._compile (internal/modules/cjs/loader.js:778:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10) at Module.load (internal/modules/cjs/loader.js:653:32) at tryModuleLoad (internal/modules/cjs/loader.js:593:12) at Function.Module._load (internal/modules/cjs/loader.js:585:3) at Module.require (internal/modules/cjs/loader.js:692:17) at require (internal/modules/cjs/helpers.js:25:18) at Object. (/usr/local/lib/node_modules/@neutralinojs/neu/src/neu-cli.js:2:13)

Then I again removed those two ? in that line and rebuilt. On again running neu it worked -

a*****@******-popos-desktop:~$ neu
  _   _            _             _ _             _     
 | \ | | ___ _   _| |_ _ __ __ _| (_)_ __   ___ (_)___ 
 |  \| |/ _ \ | | | __| '__/ _` | | | '_ \ / _ \| / __|
 | |\  |  __/ |_| | |_| | | (_| | | | | | | (_) | \__ \
 |_| \_|\___|\__,_|\__|_|  \__,_|_|_|_| |_|\___// |___/
                                              |__/     
Usage: neu [options] [command]

Options:
  -h, --help                     display help for command

Commands:
  create [options] <binaryName>  creates an app based on template (neutralinojs-minimal by
                                 default)
  run [options]                  fetches config from neutralino.config.json & runs the app
  build [options]                builds binaries for all supported platforms and
                                 resources.neu file
  update                         updates neutralinojs binaries and client library
  version                        displays global and project specific versions of packages
  plugins [options] [plugin]     displays, adds or removes plugins
  help [command]                 display help for command`

I hope this will help with fixing some issue 🤔️🙂️

SmartyGrasshopper commented 2 years ago

My earlier node version was something like 10.0.... It was because I simply used sudo apt install node. I installed nvm and updated node to 16.17.0 and it resolved the issue.