I am trying to run a React-app blank project, and I'm getting this error:
~/dev/js🌏npx create-react-app my-app
npx: installed 67 in 3.618s
Creating a new React app in /home/erik/dev/js/my-app.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...
yarn add v1.22.10
[...]
└─ [email protected]
Done in 6.68s.
Removing template package using yarnpkg...
yarn remove v1.22.10
[...]
Done in 4.42s.
Created git commit.
Success! Created my-app at /home/erik/dev/js/my-app
[...]
Happy hacking!
~/dev/js/my-app[master]🌏y start
yarn run v1.22.10
$ react-scripts start
/home/erik/dev/js/my-app/node_modules/tapable/lib/HookCodeFactory.js:383
args({ after, after } = {}) {
^^^^^
SyntaxError: Duplicate parameter name not allowed in this context
at wrapSafe (internal/modules/cjs/loader.js:979:16)
at Module._compile (internal/modules/cjs/loader.js:1027:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.<anonymous> (/home/erik/dev/js/my-app/node_modules/tapable/lib/SyncBailHook.js:8:25)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
~/dev/js/my-app[master]🌏
~/dev/js/my-app[master ?]🌏npm -v
6.14.10
~/dev/js/my-app[master ?]🌏node -v
v14.15.4
~/dev/js/my-app[master ?]🌏y -v
1.22.10
~🌏whereis yarn
yarn: /home/erik/.nvm/versions/node/v14.15.4/bin/yarn
But if I run npm i && npm start
, this works. After this, yarn start
works, but it's not ideal.
This happens in other projects too, in fact, I'm trying to setup a more complex react app.
It seems like yarn is not "~compiling/transpiling~" (what's the verb?) the modules correctly, my file looks like:
/**
* Gets the source code for the given node.
* @param {ASTNode} [node] The AST node to get the text for.
* @param {int} [afterCount] The number of characters after the node to retrieve.
* @param {int} [afterCount] The number of characters after the node to retrieve.
* @returns {string} The text representing the AST node.
* @public
*/
getText(node, afterCount, afterCount) {
if (node) {
return this.text.slice(Math.max(node.range[0] - (afterCount || 0), 0),
node.range[1] + (afterCount || 0));
}
return this.text;
}
and my colleague's look like:
/**
* Gets the source code for the given node.
* @param {ASTNode} [node] The AST node to get the text for.
* @param {int} [beforeCount] The number of characters before the node to retrieve.
* @param {int} [afterCount] The number of characters after the node to retrieve.
* @returns {string} The text representing the AST node.
* @public
*/
getText(node, beforeCount, afterCount) {
if (node) {
return this.text.slice(Math.max(node.range[0] - (beforeCount || 0), 0),
node.range[1] + (afterCount || 0));
}
return this.text;
}
I re-installed Ubuntu a week ago. Changing nvm versions and even using default ubuntu nodejs package doesn't solve the problem.
I tried different yarn and node versions, same results.
The file in Github is the correct one: https://github.com/webpack/tapable/blob/v1.1.3/lib/HookCodeFactory.js#L383, but the package.json version in my code is the latest and the same.
I noticed other similar errors, which all seem related to before/after assignments.
node_modules
and useyarn && yarn start
?