Problem with building the front-end-template - substrate

I am trying to install and use the React front end template for Substrate as per this tutorial, but when I run yarn install or yarn start in the project's root directory I get this error:
/home/.../substrate-front-end-template/.yarn/releases/yarn-berry.cjs:2
module.exports=(()=>{var e=
*blah blah blah*
SyntaxError: Unexpected reserved word
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:616:28)
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)
at bootstrap_node.js:609:3
I am using yarn v.1.22.11 and node v.8.10.0. How can I fix this issue?

Check versions of Yarn and NodeJS. On those versions on my end all works fine:
tomek#rhei-box:~/workspaces/substrate-front-end-template$ node -v
v12.22.4
tomek#rhei-box:~/workspaces/substrate-front-end-template$ yarn -v
2.4.0
In case you are on Linux-like machine check nvm tool in order to be able to change fast versions of NodeJS.

Related

Error: Cannot find module '#npmcli/map-workspaces'

Whenever I try to run any npm command I get the following error:
Error: Cannot find module '#npmcli/map-workspaces'
Require stack:
- C:\Users\Lenovo\AppData\Roaming\npm\node_modules\npm\node_modules\#npmcli\config\lib\index.js
- C:\Users\Lenovo\AppData\Roaming\npm\node_modules\npm\lib\npm.js
- C:\Users\Lenovo\AppData\Roaming\npm\node_modules\npm\lib\cli.js
- C:\Users\Lenovo\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js
at Module._resolveFilename (node:internal/modules/cjs/loader:1039:15)
at Module._load (node:internal/modules/cjs/loader:885:27)
at Module.require (node:internal/modules/cjs/loader:1105:19)
at require (node:internal/modules/cjs/helpers:103:18)
at Object.<anonymous> (C:\Users\Lenovo\AppData\Roaming\npm\node_modules\npm\node_modules\#npmcli\config\lib\index.js:6:23)
at Module._compile (node:internal/modules/cjs/loader:1218:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1272:10)
at Module.load (node:internal/modules/cjs/loader:1081:32)
at Module._load (node:internal/modules/cjs/loader:922:12)
at Module.require (node:internal/modules/cjs/loader:1105:19)
I have installed Nodejs and I have all the necessary paths set in my environment variables.
Under my User Variables in Paths I have included the following paths:
C:\Program Files\nodejs
C:\Users\Lenovo\AppData\Roaming\npm
My node version is v18.13.0
I also have nvm installed and the version is 1.1.10
Please advice on the way forward

React Native init fails on cocoapods install

I am facing a rather strange bug. If I react-native init through my terminal, cocoapods installs fine.
If I init a new project through vscode's integrated terminal, I get this error during pod install:
For help, see: https:/nodejs.org/en/docs/inspector
Debugger attached.
Waiting for the debugger to disconnect...'
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
[!] Invalid `Podfile` file: 859: unexpected token at ''.
# from /Users/XXXXX/Documents/test/ios/Podfile:7
# -------------------------------------------
# target 'test' do
> config = use_native_modules!
#
# -------------------------------------------
I have verified that my LANG variable is the same on both terminals: en_US.UTF-8
Ruby version: ruby 3.1.1p18 (2022-02-18 revision 53f5fc4236) [arm64-darwin21]
Cocoapods version: 1.11.3
I have tried installing ruby through brew, rbenv, rvm. The problem remains on all three.
I am on MacOS Monterey 12.1 on M1.

SailsJS remove bluebird

I want to remove the bluebird package installed in my sails app, in favor of the native Node promises.
But after I set npm remove bluebird --save, I get:
Error: Cannot find module 'bluebird'
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 Object.<anonymous> (/candyvoice/node_modules/sails/node_modules/consolidate/lib/consolidate.js:22:15)
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)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/candyvoice/node_modules/sails/node_modules/consolidate/index.js:1:80)
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)
I don't use bluebird anywhere in my code so I'm guessing this is somehow a Sails dependency? The stacktrace doesn't refer to any of my files either.
Thanks
Bluebird is a SailsJS dependency.
You can use native promises in your application alongside Sails' bluebird ones and it'll work seamlessly.
Bluebird has thousands of tests to ensure that its promises work seamlessly with native ones - and bluebird contributors are also NodeJS contributors that ensure it doesn't break from the other side either. (Full disclosure, I'm a bluebird contributor and a NodeJS collaborator).
Simply don't use bluebird in your own code - and things will work well :)
As a caveat, in NodeJS 8 there's a chance unhandled promise rejections will throw. You can fix this by setting process.on("unhandledRejection" which will set the same behavior to all promises.

Shell command in ruby: Path problems

The following shell script should check my ruby project for lint coffeescript and scss.
#!/usr/bin/env ruby
puts "\n== Checking if CoffeeScript is lint =="
checks << system("coffeelint -f .coffeelint.json ./app/assets/javascripts/**/*.coffee")
puts "\n== Checking if SCSS is lint =="
checks << system("scss-lint ./app/assets/stylesheets/**/*.scss")
exit 1 if checks.include?(false)
But the output of running that script in zsh is the following:
== Checking if CoffeeScript is lint ==
fs.js:849
return binding.stat(pathModule._makeLong(path));
^
Error: ENOENT: no such file or directory, stat './app/assets/javascripts/**/*.coffee'
at Error (native)
at Object.fs.statSync (fs.js:849:18)
at findCoffeeScripts (/Users/josua/.nvm/versions/io.js/v2.3.3/lib/node_modules/coffeelint/lib/commandline.js:79:14)
at Object.<anonymous> (/Users/josua/.nvm/versions/io.js/v2.3.3/lib/node_modules/coffeelint/lib/commandline.js:247:17)
at Object.<anonymous> (/Users/josua/.nvm/versions/io.js/v2.3.3/lib/node_modules/coffeelint/lib/commandline.js:254:4)
at Module._compile (module.js:430:26)
at Object.Module._extensions..js (module.js:448:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (/Users/josua/.nvm/versions/io.js/v2.3.3/lib/node_modules/coffeelint/bin/coffeelint:34:5)
at Module._compile (module.js:430:26)
at Object.Module._extensions..js (module.js:448:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:471:10)
at startup (node.js:117:18)
at node.js:948:3
== Checking if SCSS is lint ==
No such file or directory # rb_sysopen - ./app/assets/stylesheets/**/*.scss
It seems like the current working path is wrong, but at least puts system("pwd") is showing the correct directory from where the relative paths in the arguments should be reachable.
What's going on here?

Running a compass task with gulp results in a LoadError

When running a compass task with Gulp (on OSX), I receive the following error. I've tried installing specific versions of both compass and sass (in various orders) without any notable effect.
[17:25:46] LoadError on line ["54"] of /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb: cannot load such file -- compass/import-once/activate
Run with --trace to see the full backtrace
events.js:72
throw er; // Unhandled 'error' event
^
Error: Compass failed
at Transform.<anonymous> (/Users/liamegan/Projects/WTC/nintendo.wethecollective.com/html/Websites/Kids/web/node_modules/gulp-compass/index.js:37:28)
at ChildProcess.<anonymous> (/Users/liamegan/Projects/WTC/nintendo.wethecollective.com/html/Websites/Kids/web/node_modules/gulp-compass/lib/compass.js:136:7)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:743:16)
at Socket.<anonymous> (child_process.js:956:11)
at Socket.EventEmitter.emit (events.js:95:17)
at Pipe.close (net.js:465:12)
My compass version is 0.12.7 and my sass version is 3.3.13 however I've also tried with sass 3.2.19.
My sass gulp process is as follows:
gulp.task('sass', function() {
gulp
.src('./_src/sass/screen.scss')
.pipe(compass({
config_file: './config.rb'
}))
.pipe(gulp.dest('./assets/css'))
})
Any help or insight would be greatly appreciated.
Cheers,
L
I fixed this with the following:
sudo gem uninstall sass
sudo gem uninstall compass
sudo gem install sass
sudo gem install compass --pre
This installed the prerelease version of compass which works with the latest, stable version of sass.

Resources