I installed the Prettier plugin, installed Prettier with npm into my project, and when I try to use it to reformat something, it acts like there's a bug in Prettier. Here's what I get.
<...>node_modules\prettier\index.js:12947
} catch {
^
SyntaxError: Unexpected token {
at new Script (vm.js:51:7)
at createScript (vm.js:136:10)
at Object.runInThisContext (vm.js:197:10)
at Module._compile (module.js:613:28)
at Object.Module._extensions..js (module.js:660:10)
at Module.load (module.js:561:32)
at tryModuleLoad (module.js:501:12)
at Function.Module._load (module.js:493:3)
at Module.require (module.js:593:17)
at require (internal/module.js:11:18)
Process finished with exit code -1
Any ideas?
My guess is that you're running an old version of Node.js that doesn't support optional catch binding. What Node.js version is chosen in Settings | Languages & Frameworks | Node.js?
Related
I've been following Tailwind's tutorials and when. I get to the part of the tutorial where they ask me to run npx tailwindcss-cli build css/tailwind.css -o build/tailwind.css, I get the following error. How do I solve this?
(node:5568) ExperimentalWarning: The fs.promises API is experimental
/Users/USERNAME-REDACTED/.npm/_npx/8bcfa250e55e6bf5/node_modules/tailwindcss/lib/jit/corePlugins.js:242
...Object.fromEntries(Object.entries(corePlugins).map(([pluginName, plugin]) => {
^
TypeError: Object.fromEntries is not a function
at Object.<anonymous> (/Users/USERNAME-REDACTED/.npm/_npx/8bcfa250e55e6bf5/node_modules/tailwindcss/lib/jit/corePlugins.js:242:13)
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.<anonymous> (/Users/USERNAME-REDACTED/.npm/_npx/8bcfa250e55e6bf5/node_modules/tailwindcss/lib/jit/lib/setupContextUtils.js:36:43)
at Module._compile (internal/modules/cjs/loader.js:778:30)
I've tried deleting npm, updating npm, removing my package-lock and node modules and restarting, and adding -i. all to no prevail. As is made apparent from the youtube series I linked, I'm just learning tailwind, so I'm sure it's a super stupid mistake.
The issue originated from your node version.
Please try this:
sudo npm i -g n
Than inside your project folder
n latest
after that close your current terminal, since it will remember the old node location, open a new one and it should be fixed.
If you don't want the overhead of nvm then you can just download a binary release of nodejs, eg:
mkdir -p ~/opt/src
cd ~/opt/src
wget https://nodejs.org/download/release/v14.17.0/node-v14.17.0-linux-x64.tar.xz
cd ~/opt tar xf src/node-v14.17.0-linux-x64.tar.xz --strip 1
To use it interactively first run:
export PATH=$HOME/opt/bin:$PATH
Source:https://community.opalstack.com/d/636-install-node-and-npm-without-having-to-sudo
I installed polymer using the recommended syntax:
npm install -g polymer-cli#next
I created a polymer 2 element using the polymer init interface.
The issue I'm having is when I run polymer serve, I get the following error:
error: cli runtime exception: SyntaxError: Unexpected token [
error: SyntaxError: Unexpected token [
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:413:25)
at Object.Module._extensions..js (module.js:452: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> (/usr/local/lib/node_modules/polymercli/node_modules/polyserve/lib/start_server.js:33:30)
at Module._compile (module.js:434:26)
at Object.Module._extensions..js (module.js:452:10)`
I tried uninstalling and reinstalling polymer, but getting the same issue. Any ideas??
Fixed my polymer client error.
It turns out the new version of polymer required node v6 or higher.. barely noticed that notice message when I installed.
I get an error while installing React-native, I have tried to search for an answer, but I can not find one.
When running "react-native init meet" I get this error:
This will walk you through creating a new React Native project in /Users/alfred/React/meet
Installing react-native package from npm...
Setting up new React Native app in /Users/alfred/React/meet
module.js:338
throw err;
^
Error: Cannot find module './src/init'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:286:25)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (/Users/alfred/React/meet/node_modules/react-native/node_modules/yeoman-generator/node_modules/download/node_modules/vinyl-fs/node_modules/gulp-sourcemaps/index.js:4:9)
at Module._compile (module.js:434:26)
at Module._extensions..js (module.js:452:10)
at Object.require.extensions.(anonymous function) [as .js] (/Users/alfred/React/meet/node_modules/react-native/node_modules/babel-register/lib/node.js:152:7)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
I don't really get what is wrong...
It's related to an issue with gulp-sourcemaps recent deployment https://github.com/floridoo/gulp-sourcemaps/issues/238
A project maintainer says at the end of the thread that he'll get to it today and
For the time being lock your version down to 2.0.x or 1.7.x
To fix, add specific version in your package.json until the issue is fixed:
{
"devDependencies": {
"gulp-sourcemaps": "1.7.x"
}
}
Use npm shrinkwrap to prevent similar issues in the future.
This is caused by a recent change in gulp-sourcemaps. See bug here: https://github.com/floridoo/gulp-sourcemaps/issues/238
This is now fixed. Run npm install
https://github.com/floridoo/gulp-sourcemaps/issues/238
I am trying to follow polymer tutorial: https://www.polymer-project.org/1.0/start/toolbox/set-up
When I run a polymer command like polymer help, it allways throws the following error:
C:\(...)\npm\node_modules\polymer-cli\bin\polymer.js:19
let lib = path ? require(path) : require('..');
^^^
SyntaxError: Unexpected strict mode reserved word
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
I already reinstalled Polymer cli, but it returns allways the same error.
I found the solution!
I reinstalled node js and now I can run Polymer.
Maybe I had an unsuported version of node js.
I am trying to launch polyserve on my local development environment but it is not working. thought it might be due to node.js updated node but still getting this error.
/usr/local/lib/node_modules/polyserve/bin/polyserve:14
const resolve = require('resolve'); ^^^^^ SyntaxError: Use of const in
strict mode.
at Module._compile (module.js:439:25)
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 Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:906:3
According to my copy of polyserv, its package.json file says it needs the resolve module
https://www.npmjs.com/package/resolve
Your error is that it can't find it.
Is polyserve installed locally - run npm install