Error: Illegal characters in path in npm rimraf - windows

I am getting an error while I tried to delete multiple directories using npm rimraf.
Error: Illegal characters in path
Command I run is rimraf **/lib/**
> ecommerce.ui#0.7.2 clean-libs
> rimraf **/lib/**
Error: Illegal characters in path.
at pathArg (C:\Users\SUDARANGA\AppData\Roaming\nvm\v18.9.0\node_modules\rimraf\dist\cjs\src\path-arg.js:45:33)
at C:\Users\SUDARANGA\AppData\Roaming\nvm\v18.9.0\node_modules\rimraf\dist\cjs\src\index.js:34:66
at Array.map (<anonymous>)
at C:\Users\SUDARANGA\AppData\Roaming\nvm\v18.9.0\node_modules\rimraf\dist\cjs\src\index.js:34:28
at main (C:\Users\SUDARANGA\AppData\Roaming\nvm\v18.9.0\node_modules\rimraf\dist\cjs\src\bin.js:134:11)
at Object.<anonymous> (C:\Users\SUDARANGA\AppData\Roaming\nvm\v18.9.0\node_modules\rimraf\dist\cjs\src\bin.js:143:5)
at Module._compile (node:internal/modules/cjs/loader:1119:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1173:10)
at Module.load (node:internal/modules/cjs/loader:997:32)
at Module._load (node:internal/modules/cjs/loader:838:12) {
path: 'C:\\source\\Ecommerce.UI\\**\\lib\\**',
code: 'EINVAL'
}

Version v4 of rimraf removed globbing support, but they might add it back as per rimraf/issues/249.
If you're using rimraf just for the command line usage (i.e. using it as an npm command and not using the javascript API), then I've found that del-cli seems to be a good cross-platform replacement.

Related

Getting error when trying to run Ganache (forking BSC chain)

I have installed Ganache following instructions from https://github.com/trufflesuite/ganache#documentation
I am trying to fork BSC chain for which I have a node running locally which is fully synced (I want to fork this for which I have provided the URL in package.json under scripts).
When trying to run Ganache using npm run ganache it is giving me this error. Any idea how can I solve this?
SyntaxError: Unexpected token '?'
at wrapSafe (internal/modules/cjs/loader.js:915:16)
at Module._compile (internal/modules/cjs/loader.js:963:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Module.require (internal/modules/cjs/loader.js:887:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.__webpack_require__.f.require (/usr/local/lib/node_modules/ganache/dist/node/cli.js:2:21481)
at /usr/local/lib/node_modules/ganache/dist/node/cli.js:2:20777
at Array.reduce (<anonymous>)`
Supposedly it was supposed to run after this, so why i am getting this error?
Check your Node.js version:
node -v
v18.13.0
Version must be >= v14.0.0. After updating to the latest Node.js version, the error no longer occurred for me.

Assertion Error while compiling Solidity code in Ethereum

H:\Ethereum\Kickstarter\ethereum>node compile.js
H:\Ethereum\Kickstarter\node_modules\solc\soljson.js:1
(function (exports, require, module, __filename, __dirname) { var Module;if(!Module)Module=(typeof Module!=="undefined"?Module:null)||{};var moduleOverrides={};for(var key in Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}var ENVIRONMENT_IS_WEB=typeof window==="object";var ENVIRONMENT_IS_WORKER=typeof importScripts==="function";var ENVIRONMENT_IS_NODE=typeof process==="object"&&typeof require==="function"&&!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_WORKER;var ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER;if(ENVIRONMENT_IS_NODE){if(!Module["print"])Module["print"]=function print(x){process["stdout"].write(x+"\n")};if(!Module["printErr"])Module["printErr"]=function printErr(x){process["stderr"].write(x+"\n")};var nodeFS=require("fs");var nodePath=require("path");Module["read"]=function read(filename,binary){filename=nodePath"normalize";var ret=nodeFS"readFileSync";if(!ret
AssertionError [ERR_ASSERTION]: Invalid callback specified.
at wrapCallback (H:\Ethereum\Kickstarter\node_modules\solc\wrapper.js:16:5)
at runWithReadCallback (H:\Ethereum\Kickstarter\node_modules\solc\wrapper.js:37:42)
at compileStandard (H:\Ethereum\Kickstarter\node_modules\solc\wrapper.js:78:14)
at Object.compileStandardWrapper (H:\Ethereum\Kickstarter\node_modules\solc\wrapper.js:85:14)
at Object. (H:\Ethereum\Kickstarter\ethereum\compile.js:19:21)
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)
The following would get the latest stable version of the Solidity Compiler:
npm install --save solc
For me the issue was with this version. I downgraded solc using the following command to an older version (after removing the currently installed version).
npm install --save solc#0.4.17
This resolved the issue. Furthermore, I changed the first line of my smart contract in my contracts directory to:
pragma solidity ^0.4.17;
run following command, as suggested by Divyanshu
npm install --save solc#0.4.17
and verify that the first line of your contract is
pragma solidity ^0.4.17;

Cannot run Visual Studio code script via symlink

So, I built Visual Studio Code from source and intend to keep using it like that. But now everytime I want to open it I have to run a script from its directory. I made a symlink to that script in my /usr/local/bin but unfortunately when I run it it says this:
device:scripts work$ sudo code
Password:
module.js:550
throw err;
^
Error: Cannot find module './product.json'
at Function.Module._resolveFilename (module.js:548:15)
at Function.Module._load (module.js:475:25)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at [eval]:1:1
at ContextifyScript.Script.runInThisContext (vm.js:50:33)
at Object.runInThisContext (vm.js:139:38)
at Object.<anonymous> ([eval]-wrapper:6:22)
at Module._compile (module.js:653:30)
at evalScript (bootstrap_node.js:479:27)
module.js:550
throw err;
^
Error: Cannot find module '/usr/local/build/lib/electron.js'
at Function.Module._resolveFilename (module.js:548:15)
at Function.Module._load (module.js:475:25)
at Function.Module.runMain (module.js:694:10)
at startup (bootstrap_node.js:204:16)
at bootstrap_node.js:625:3
/usr/local/bin/code: line 29: ./node_modules/.bin/gulp: No such file or directory
module.js:550
throw err;
^
Error: Cannot find module '/usr/local/build/lib/builtInExtensions.js'
at Function.Module._resolveFilename (module.js:548:15)
at Function.Module._load (module.js:475:25)
at Function.Module.runMain (module.js:694:10)
at startup (bootstrap_node.js:204:16)
at bootstrap_node.js:625:3
/usr/local/bin/code: line 41: ./node_modules/.bin/gulp: No such file or directory
/usr/local/bin/code: line 50: /usr/local/.build/electron/.app/Contents/MacOS/Electron: No such file or directory
/usr/local/bin/code: line 50: exec: /usr/local/.build/electron/.app/Contents/MacOS/Electron: cannot execute: No such file or directory
I perfectly understand that it cannot access some files, but I don't understand why. Are there any nuances regarding running electron apps?
Okay, guys. I think I solved this problem. When I ran code.sh via symlink it tried to find necessary files in the directories from my PATH variable. As I intended to run this script from anywhere but original folder they obviously wouldn't be found. So all I had to do was exporting original script directory to PATH.
As I didn't want to bloat my PATH I wrote a little helper script and made a symlink to it from /usr/local/bin/
Here's the code:
#!/bin/sh
export PATH=$PATH:/Users/work/Stuff/vscode/
cd /Users/work/Stuff/vscode/
./scripts/code.sh

Cordova 4.3.0 - build command returns error Cannot find module 'Q'

After updating cordova to version 4.3.0 the command:
cordova build
returns the following error:
module.js:340
throw err;
^
Error: Cannot find module 'Q'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/Volumes/CaseSensitive/ios_projects/_Tests/testGruntCordova/testGruntCordova/platforms/ios/cordova/lib/check_reqs.js:25:13)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
ERROR building one of the platforms: Error: /Volumes/CaseSensitive/ios_projects/_Tests/testGruntCordova/testGruntCordova/platforms/ios/cordova/build: Command failed with exit code 8
You may not have the required environment or OS to build this project
Error: /Volumes/CaseSensitive/ios_projects/_Tests/testGruntCordova/testGruntCordova/platforms/ios/cordova/build: Command failed with exit code 8
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:131:23)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:753:16)
at Process.ChildProcess._handle.onexit (child_process.js:820:5)
I have already tried to remove and add the platform ios but nothing changes.
I have tried to run:
sudo npm install -g cordova / sudo npm install cordova
sudo npm install -g Q / sudo npm install Q
but nothing changes.
Any help?
Thank you very much
There was a bug and I have released a patch to it:
Apache Cordova ios - Git Repository
This is a bug shown on case-sensitive systems such as Unix, Linux and some OS X (if set as case-sensitive).
So far, to fix it, you have to locate those files containing a line like this:
Q = require('Q')
You can locate the files while standing on your project directory using grep:
grep -HnrI "require('Q" *;
then, use any text editor to manually change the mentioned line to:
Q = require('q')
Alternatively you can edit the related files on a more straight forward way by running the following command on your project directory:
grep -rl "require('Q" * | xargs sed -i "" "s/'Q'/'q'/g";
The single line above searches and edits the files that need the change.
Removing and then re-adding the platform again also works:
cordova platform remove ios
cordova platform add ios
Now you can cordova build ios :)
As mentioned by MeV this was a bug.

Node.js: Error: Cannot find module 'stack'

I tried to install howtonode.org on my Osx
cd ~/Sites/
git clone git#github.com:creationix/howtonode.org
My context is the following:
OSx version: 10.7.4
node -v v0.6.15
When I try to run the following command
~/Sites/howtonode.org node server/server.js &
I get the following error:
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: Cannot find module 'stack'
at Function._resolveFilename (module.js:332:11)
at Function._load (module.js:279:25)
at Module.require (module.js:354:17)
at require (module.js:370:17)
at Object.<anonymous> (/Users/antoniopierro/Sites/howtonode.org/server/server.js:2:13)
at Module._compile (module.js:441:26)
at Object..js (module.js:459:10)
at Module.load (module.js:348:31)
at Function._load (module.js:308:12)
at Array.0 (module.js:479:10)
[1]+ Exit 1 node server/server.js
any ideas?
Try running node ~/Sites/howtonode.org/server/server.js & or go to ~/Sites/howtonode.org/server/ and runnode server
Also, you have not installed the dependencies from package.json.
Go to ~/Sites/howtonode.org/ and type inn npm install. This will install all the dependencies in ~/Sites/howtonode.org/node_modules. You can then run the server.

Resources