KeystoneJS can't update post - javascript

UPDATE It seems the problem is I can't update/edit my post. Every time I create a new post, then it enter dead loop. Please help me T-T
Recently I started a program using keystoneJS as my CMS.
Everything goes fine but this Post problem.
I have found if I install keystone-demo via yo keystone(using the KeystoneJS generator made with Yeoman) then publishing post can work, but if I install keystone manually, the problem comes...
In Google Inspect Console, there is a error-
"TypeError: undefined is not an object (evaluating 'refList.expandColumns')"
I guess it is the keystone version problem.
This is my package.json file
{
"name": "keystone-demo",
"version": "1.0.1",
"private": true,
"repository": {
"type": "git",
"url": "https://github.com/JedWatson/keystone-demo.git"
},
"dependencies": {
"keystone": "https://github.com/keystonejs/keystone.git",
"async": "^1.5.0",
"lodash": "^3.10.1",
"csv": "^0.4.6",
"gulp": "^3.9.1",
"gulp-less": "^3.1.0",
"gulp-shell": "^0.5.2",
"gulp-watch": "^4.3.5",
"pug": "^2.0.0-alpha6"
},
"scripts": {
"start": "node keystone.js"
}
}
And this is the package.json file in that can work normally version
{
"name": "keystone",
"version": "0.0.0",
"private": true,
"dependencies": {
"keystone": "^0.3.16",
"async": "^1.5.0",
"underscore": "^1.8.3",
"node-sass": "^3.3.2",
"node-sass-middleware": "^0.9.7",
"dotenv": "^1.1.0"
},
"devDependencies": {
"gulp": "^3.7.0",
"gulp-jshint": "^1.9.0",
"jshint-stylish": "^0.1.3",
"gulp-shell": "^0.5.0",
"gulp-watch": "^4.3.5",
"gulp-sass": "^2.0.4"
},
"engines": {
"node": ">=0.10.22",
"npm": ">=1.3.14"
},
"scripts": {
"start": "node keystone.js"
},
"main": "keystone.js"
}

You're loading the latest keystone version from github, which is not always stable. This is probably the reason for the error you're seeing.
I recommend using the latest version published to npm (0.3.22 at time of writing) instead.
Update the first line in your dependencies to this, and it will work:
"keystone": "^0.3.22",
To add keystone to a new project you can also type npm install --save keystone

Related

npm update not updating all the outdated modules

I have certain node modules that i want to update. If i run npm outdated i see a list of modules and when i run npm update not all modules are updated.
I still see some in the list when i run npm outdated
my node version is v12.16.2
i see the below list when executing npm outdated
Below are the contents of my package.json
{
"name": "exporter",
"version": "1.0.0",
"description": "api endpoint",
"main": "server.js",
"dependencies": {
"#sentry/node": "5.30",
"abort-controller": "^3.0.0",
"archiver": "^5.2.0",
"aws-sdk": "^2.825.0",
"body-parser": "^1.19.0",
"bull": "^3.20.0",
"bull-board": "^0.9.0",
"config": "^3.3.3",
"cors": "^2.8.5",
"csv": "^5.3.2",
"dotenv": "^8.2.0",
"exceljs": "^4.2.0",
"express": "^4.17.1",
"express-basic-auth": "^1.2.0",
"express-rate-limit": "^5.2.3",
"fs": "0.0.1-security",
"generic-pool": "^3.7.1",
"helmet": "^4.3.1",
"jimp": "^0.16.1",
"JSONStream": "^1.3.5",
"jsonwebtoken": "^8.5.1",
"morgan": "^1.10.0",
"node-fetch": "^2.6.1",
"nodemailer": "^6.5.0",
"pg": "^8.6.0",
"pg-query-stream": "^4.1.0",
"pm2": "^4.5.1",
"puppeteer": "^5.5.0",
"rate-limit-redis": "^2.0.0",
"twitter": "^1.7.1",
"underscore": "^1.12.0",
"uuid": "^8.3.2"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "/usr/local/bin/pm2 restart all --update-env"
},
"author": "",
"license": "ISC"
}
How can i update all the below modules, specifically pm2 and puppeteer. Thanks.
npm update respects semver constraints.
This command will update all the packages listed to the latest version (specified by the tag config), respecting the semver constraints of both your package and its dependencies (if they also require the same package).
According to the package.json, the constraints are
#sentry/node: exact version
bull-board, dotenv, pm2, puppeteer: caret range
The packages are up-to-date according to these constraints.
To get the latest versions, you can install packages with the #latest tag.
Note that these are major version updates - things can break.

Ember Quickstart tutorial: Parsing error: Unexpected character '#' in '#action'

I just started using Ember and I have some trouble with the Ember Quickstart tutorial. Currently, I get Parsing error: Unexpected character '#' in line 5 of people-list.js:
import Component from '#glimmer/component';
import { action } from '#ember/object';
export default class PeopleListComponent extends Component {
#action
showPerson(person) {
alert(`The person's name is ${person}!`);
}
}
What's wrong here? The code is copied from the tutorial.
This is the output of ember -v:
ember-cli: 3.18.0
node: 11.13.0
os: darwin x64
This is my package.json. I can run npm install, but yarn install gives me The engine "node" is incompatible with this module. Expected version "10.* || >= 12". Got "11.13.0".
{
"name": "ember-quickstart",
"version": "0.0.0",
"private": true,
"description": "Small description for ember-quickstart goes here",
"repository": "",
"license": "MIT",
"author": "",
"directories": {
"doc": "doc",
"test": "tests"
},
"scripts": {
"build": "ember build",
"lint:hbs": "ember-template-lint .",
"lint:js": "eslint .",
"start": "ember serve",
"test": "ember test"
},
"devDependencies": {
"#ember/jquery": "^0.5.2",
"#ember/optional-features": "^0.6.3",
"broccoli-asset-rev": "^2.7.0",
"ember-ajax": "^5.0.0",
"ember-cli-app-version": "^3.2.0",
"ember-cli-babel": "^7.1.2",
"ember-cli-dependency-checker": "^3.1.0",
"ember-cli-eslint": "^4.2.3",
"ember-cli-htmlbars": "^3.0.0",
"ember-cli-htmlbars-inline-precompile": "^1.0.3",
"ember-cli-inject-live-reload": "^1.8.2",
"ember-cli-sri": "^2.1.1",
"ember-cli-template-lint": "^1.0.0-beta.1",
"ember-cli-uglify": "^2.1.0",
"ember-data": "~3.9.0",
"ember-export-application-global": "^2.0.0",
"ember-load-initializers": "^1.1.0",
"ember-maybe-import-regenerator": "^0.1.6",
"ember-qunit": "^3.4.1",
"ember-resolver": "^5.0.1",
"ember-source": "~3.9.0",
"ember-welcome-page": "^3.2.0",
"eslint-plugin-ember": "^5.2.0",
"loader.js": "^4.7.0",
"qunit-dom": "^0.8.0"
},
"engines": {
"node": "10.* || >= 12"
},
"dependencies": {
"ember-cli": "^3.18.0",
"#glimmer/component": "^1.0.0"
}
}
Adding some text here as SO won't let me post the question otherwise.
You're ember-source is set to ~3.9.0. I'm pretty sure #action is an Octane feature that was added in 3.14.
Either update ember-source to 3.14 or newer or switch to the 3.9.0 documentation. I'd recommend updating as Octane is awesome.
The output says you currently have ember-cli 3.18, but your app seems to have been generated by an older ember-cli 3.9 as indicated by devDependencies.
As mentioned in the comments, 3.9 does not have access to some of the current features unless you install some polyfills.
If regenerating the app is a possibility, I would suggest doing it.
Run ember --version to make sure 3.18 is being called
Run ember new my-app-name and check that package.json has 3.18 for ember-source.
Go through the quickstart!
Alternatively, you can run npx ember-cli new my-app-name and it should generate an app using the latest ember-cli version available in npm.
If you don't want to lose some work you might have done, you can check out ember-cli-update by running something like npx ember-cli-update. Check the README for more info.

Make ES6 Internet Explorer 11 compliant using Grunt-Babel

I installed grunt-babel in order to allow IE 11 users on our site. Right now the site is broken for those users. I've been mostly successful except I've gotten the following error that I don't know how to address.
ReferenceError: regeneratorRuntime is not defined
It looks like polyfills are deprecated so I'm wondering what is the best solution.
EDIT
Following justDan and David's advice, I installed regenerator/runtime package and am now getting an error require is not defined
This code will be run through the browser. My company is using a custom CMS which requires us to compress the theme file and there are large sections requiring dynamically populated text which is part of the reason for using ES6 template literals.
package.json file
{
"name": "Some Site",
"version": "1.0.0",
"description": "",
"main": "Gruntfile.js",
"dependencies": {
"regenerator-runtime": "^0.13.3"
},
"devDependencies": {
"#babel/core": "^7.7.2",
"#babel/preset-env": "^7.7.1",
"#babel/preset-es2015": "^7.0.0-beta.53",
"babel-preset-es2015-nostrict": "^6.6.2",
"grunt": "^1.0.4",
"grunt-autoprefixer": "^3.0.4",
"grunt-babel": "^8.0.0",
"grunt-contrib-compress": "^1.5.0",
"grunt-contrib-concat": "^1.0.1",
"grunt-contrib-cssmin": "^3.0.0",
"grunt-contrib-imagemin": "^3.1.0",
"grunt-contrib-less": "^2.0.0",
"grunt-contrib-uglify": "^4.0.1",
"grunt-contrib-watch": "^1.1.0",
"grunt-purifycss": "^0.1.2"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC"
}
.babelrc file
{
"presets": ["#babel/preset-env"]
}
You need to install and run this package
https://www.npmjs.com/package/regenerator-runtime

How can I get lib ldap-client in node.js?

I can't get lib ldap-client in Node.js.
I used this page https://github.com/nodejs/node-gyp to help solve the problem.
I installed python, node-gyp, Visual Studio 2015.
All of the packages for LDAP connection have this problem.
I'm working in Windows 7.
Here's my package.json:
{
"name": "taakapis",
"version": "0.0.0",
"private": true,
"main": "app.js",
"scripts": {
"start": "node ./bin/www"
},
"dependencies": {
"body-parser": "latest",
"cookie-parser": "latest",
"debug": "latest",
"express": "latest",
"jade": "latest",
"morgan": "latest",
"serve-favicon": "latest",
"nodemon":"latest",
"mysql":"latest",
"date-and-time":"latest",
"trim":"latest",
"dateformat":"latest",
"is-my-json-valid":"latest",
"md5":"latest",
"ldap-client":"latest"
}
}
Attempting to resolve package ldap-client I get this:
This error can occur if your gcc version configuration is not right. So try
exporting the path.
export PATH=/opt/rh/devtoolset-2/root/usr/bin:$PATH

nodeJS - nodemon console log stopped working

I am having a weird problem, suddenly the nodemon stopped showing console log.
I am using npm run dev command to run the nodeJS app and my package.json looks like below,
{
"name": "loginform",
"version": "0.0.0",
"private": true,
"scripts": {
"start": "node ./bin/www",
"dev": "nodemon app.js"
},
"dependencies": {
"async": "^2.1.4",
"body-parser": "^1.15.2",
"body-parser-xml": "^1.1.0",
"cassandra-driver": "^3.1.6",
"connect-flash": "^0.1.1",
"ejs": "^2.0.6",
"es6-template-strings": "^2.0.1",
"express": "^4.14.0",
"express-rate-limit": "^2.6.0",
"express-session": "^1.10.1",
"log-buffer": "0.0.3",
"mongodb": "^2.2.25",
"mongoose": "^4.7.0",
"nodemailer": "^0.7.1",
"passport": "^0.2.1",
"passport-facebook": "^1.0.3",
"passport-local": "^1.0.0",
"passport-twitter": "^1.0.2",
"qs": "^6.3.0",
"sweetalert2": "^6.5.5",
"trim": "0.0.1",
"url-pattern": "^1.0.3",
"uuid": "^3.0.1",
"xml2js": "^0.4.17"
},
"devDependencies": {
"nodemon": "^1.11.0"
}
}
I was working but suddenly stopped working, I am able to figure out why, though I had installed pm2 in between but uninstalled, is this the cause that might have broken the logging?
Update
This is how my console looks, no log at all.
Can anyone help with a solution?
Thanks.
You had a typo. I am sure you run this via npm run dev.
Try removing your node_modules folder, and re run npm install

Categories

Resources