Error when running 'au new' for Aurelia cli tool - aurelia

I am trying to use the Aurelia-cli tool to create a new Aurelia project. I am using a Windows 10 machine with node and git installed.
I created a new empty folder for the project, and opened a command prompt and navigated to this folder.
I then ran the following command which completed successfully:
npm install -g aurelia-cli
Then I ran the following to create a new project:
au new
But this gave the following error:
C:\Users\xxxx\AppData\Roaming\npm\node_modules\aurelia-cli\bin\aurelia- cli.js:3
const resolve = require('../lib/resolve');
^^^^^
SyntaxError: Use of const in strict mode.
at exports.runInThisContext (vm.js:73:16)
at Module._compile (module.js:443:25)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:501:10)
at startup (node.js:129:16)
at node.js:814:3
Any ideas as to what would be causing this?

Make sure you have a compatible version of Node installed. You can check the your Node version with node -v.
Aurelia CLI is only compatible with Node >= 4.x
You can download a compatible version of Node from here.

This error was to do with the node version but it was not a process of simply downloading and installing the latest version. I got this working after going through the following steps:
Open the Node command prompt and upgrade the node version with:
npm cache clean
npm update -g
Still in the Node command prompt, go to the relevant directory and run
au new
And it worked fine.
Even after upgrading the node version as above, the version had not changed in the normal windows command prompt and the aurelia cli command still did not work from there. So this problem seems to be to do with node versions, windows, and my setup, rather than with the aurelia cli.

Related

npm v9.4.0 is known not to run on Node.js v19.5.0

I somehow broke npm on my Windows system. Any (literally any) npm command I use gives me the following illogical error:
ERROR: npm v9.4.0 is known not to run on Node.js v19.5.0. You'll need to upgrade to a newer Node.js version in order to use this version of npm. This version of npm supports the following node versions: ^14.17.0 || ^16.13.0 || >=18.0.0. You can find the latest version at https://nodejs.org/.
ERROR: C:\Users\PCName\AppData\Roaming\npm\node_modules\npm\node_modules\#npmcli\arborist:1 ../../workspaces/arborist SyntaxError: Unexpected token '.' at internalCompileFunction (node:internal/vm:73:18) at wrapSafe (node:internal/modules/cjs/loader:1166:20) at Module._compile (node:internal/modules/cjs/loader:1210:27) at Module._extensions..js (node:internal/modules/cjs/loader:1300:10) at Module.load (node:internal/modules/cjs/loader:1103:32) at Module._load (node:internal/modules/cjs/loader:942:12) at Module.require (node:internal/modules/cjs/loader:1127:19) at require (node:internal/modules/helpers:112:18) at Object.<anonymous> (C:\Users\PCName\AppData\Roaming\npm\node_modules\npm\lib\npm.js:1:18) at Module._compile (node:internal/modules/cjs/loader:1246:14)
I tried uninstalling and re-install node.
I deleted the npm folder in C:\Users\PCName\AppData\Roaming\npm\node_modules, downloaded the latest version here: https://github.com/npm/cli/releases/tag/v9.4.0, extracted it, renamed it to 'npm', and copied it to the folder where I deleted it.
I fixed this on my machine by downloading the node installer from https://nodejs.org/en/download/ I did not even bother to uninstall my existing node.
Caveat: After doing this, nvm stopped working. When I do nvm use XXXX it says that it switched versions but it did not.

How to change my node version on my computer

I updated my node version from 10.16.3 to 12.14.0.
3 months ago, I made api by using node js. At that time, it worked well.
But now it throws errors.
These are what I did and errors.
D:\Projects\Project\Mean & Mern\Angular\data\API>node server
internal/modules/cjs/loader.js:1025
return process.dlopen(module, path.toNamespacedPath(filename));
^
Error: The module '\\?\D:\Projects\Project\Mean & Mern\Angular\data\API\node_modules\bcrypt\lib\binding\bcrypt_lib.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 64. This version of Node.js requires
NODE_MODULE_VERSION 72. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
at Object.Module._extensions..node (internal/modules/cjs/loader.js:1025:18)
at Module.load (internal/modules/cjs/loader.js:815:32)
at Function.Module._load (internal/modules/cjs/loader.js:727:14)
at Module.require (internal/modules/cjs/loader.js:852:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (D:\Projects\Project\Mean & Mern\Angular\data\API\node_modules\bcrypt\bcrypt.js:6:16)
at Module._compile (internal/modules/cjs/loader.js:959:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
at Module.load (internal/modules/cjs/loader.js:815:32)
at Function.Module._load (internal/modules/cjs/loader.js:727:14)
I refer to this url: Node - was compiled against a different Node.js version using NODE_MODULE_VERSION 51
But nothing helps me.
Please help me
I have found is to just use the nodejs.org site
1. go to https://nodejs.org/en/download/releases/
2. find version you want and click download
3. click the .pkg executable and follow the installation instructions
One way is to use NVM, the Node Version Manager.
You can find it at https://github.com/creationix/nvm
It allows you to easily install and manage multiple versions of node. Here's a snippet from the help:
Usage:
nvm install <version> Download and install a <version>
nvm use <version> Modify PATH to use <version>
nvm ls List versions (installed versions are blue)
You can use nvm to select your preferred node version with ease.
Check this repo for details: https://github.com/nvm-sh/nvm
I found it!
Before I did do like this.
npm install
node server
But I couldn't run it.
I try many times to fix, and finally I found this!
npm install canvas or yarn add canvas
And now it works!
:D

React Native 0.60.4 detox postinstall.js install error

Not able to install detox by npm install or yarn.
yarn add --dev detox will fail out in the postbuild.js`
This question is in response to wix/detox's policy regarding issue tracking:
https://github.com/wix/Detox/issues/1523
Followed the latest tutorial to get started with detox.
react-native init example // (0.60.4)
brew update
brew tap wix/brew
brew install applesimutils
yarn global add detox-cli // you shouldn't need this
yarn add --dev detox // add this package in /example app
Installing detox will exit out with a childprocess error.
Error:
Command Failed: <YOUR_PROJECT_PATH>/node_modules/detox/scripts/build_framework.ios.sh
at checkExecSyncError (child_process.js:629:11)
at Object.execFileSync (child_process.js:647:13)
at Object.<anonymous> (<YOUR_PROJECT_PATH>/node_modules/detox/scripts/postinstall.js:2:27)
at Module._compile (internal/modules/cjs/loader.js:776:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787: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)
Followed their guide here:
https://github.com/wix/Detox/blob/master/docs/Introduction.GettingStarted.md
UPDATE: See the solution below, was able to get detox installed without an issue.
The detox version that was previously installed required the Legacy Build System
How to upgrade correctly:
Remove ~/Library/Detox/
Remove ~/Library/Developer/Xcode/DerivedData/*
yarn add -D detox // installs without and issue
How did this issue occur:
If you have a previous version of Detox installed which relied on an earlier Xcode you will get a conflict between Legacy & New Build System.
Detox will then look at your ~/Library/Detox data and fail to build due to New Build System being selected as default
I resolved this install error by doing the following:
In xcode 10.3 go into File > Workspace Settings
Under Shared Workspace Settings select Legacy Build System
Re-install detox (it will not use the legacy build and not error out)

"react-native start" command gives error

react-native start command gives error.Genrated error is given below. Please help me.
react-native start
/usr/lib/node_modules/react-native/local-cli/server/checkNodeVersion.js:43
);
^
SyntaxError: Unexpected token )
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:549:28)
at Object.Module._extensions..js (module.js:586:10)
at Module.load (module.js:494:32)
at tryModuleLoad (module.js:453:12)
at Function.Module._load (module.js:445:3)
at Module.require (module.js:504:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/usr/lib/node_modules/react-native/local-cli/cli.js:17:1)
I found out that if you have installed nvm to manage different node versions, is showing one version but using another from behind, I also have problems with my global brew node installation, so I had reinstalled again from scratch. As a general tip, unload the nvm and work with the npm global installation.
Update your nodejs should fix
sudo npm cache clean -f (force) clear you npm cache
sudo npm install -g n install "n" (this might take a while)
sudo n stable upgrade to lastest version
I checked the file "/usr/lib/node_modules/react-native/local-cli/server/checkNodeVersion.js:43" and found that "React Native runs on Node 8.0 or newer."
But my node vesion was 6.0 ,so that the problem.
The error belongs with node js version.
node --v in cmd will show version less than 8.
Update your node version by installing nvm. This will help you update version.
https://stackoverflow.com/a/7718438/9090200
In-case you are using nvm to install a new version of node.
It's important that you will use nvm alias default node so it will be the default version while opening new shells.
React Native runs on Node 8.0 or newer
If you are using nvm then set "nvm alias default >=8.X.X" like "nvm alias default 8.0.0"
Re-open your terminal and try it again.

Cannot find module 'npmlog'

Hello I receive the following message when trying to install npm. I downloaded the most recent node.js but it doesn't seem to download npm. I keep getting the belowenter code here error message after deleting node.js and reinstalling it.
When I try installing node.js I don't see the following being created:
C:\Users\Efren Barragan\AppData\Roaming\npm
This is the first time installing node.js. I just installed it on my old computer and it worked out fine. I am new to this so so your patience is much appreciated! Thanks!
C:\Users\Efren Barragan> npm install npm -g
module.js:327
throw err;
^
Error: Cannot find module 'npmlog'
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at C:\Users\Efren Barragan\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js:19:13
at Object.<anonymous> (C:\Users\Efren Barragan\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js:75:3)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
Due to the bug in versions this is what i did -
I have faced the same issue in my Windows 10 PC. After looking into solutions, since i couldn't find the exact solution for the issue i was facing
Cannot find module 'npmlog'
I just uninstalled the node js and then, deleted both 'npm' and 'npm-cache' in
"C:\Users\YourPCName\AppData\Roaming"
Then, i downloaded the latest version of node from Node JS Website
And, installed node js
After that i checked with the path in environment variables.
Finally run the command prompt 'run as administrator' and npm install npm -g
Checking your version will show the latest version. 'npm -v'
I got the latest version - v3.10.9
Try this. this should work.
Install a newer version, it's been a bug in previous version.