after i install the nodejs and npm , gitbook-cli ,there is an error.like this:
[root#vagrant-centos65 vagrant]# gitbook -v
/usr/lib/node_modules/gitbook-cli/node_modules/fs-extra/lib/index.js:3
const assign = require('./util/assign')
^^^^^
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 Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/usr/lib/node_modules/gitbook-cli/lib/config.js:2:10)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
[root#vagrant-centos65 vagrant]# npm -v
1.3.6
[root#vagrant-centos65 vagrant]# node -v
v0.10.48
my nodejs version and npm are v0.10.48 ,1.3.6 ,what should i do ,please help me .
As this answer explain, const support is not enabled by default in node.js version 0.10 and require --harmony flag if you want to use it.
As this version of fs-extra package use const keyword in his index.js file, you got this error.
You can have a look at this compatibility table for a summary for const and let support by version.
Just upgrade your node.js version to solve this issue.
Also, I don't think it is a good idea to launch gitbook as root user.
thanks # TGrif , i upgrade my nodejs ,and its worked.
npm cache clean -f
npm install -g n
n stable
ln -sf /usr/local/n/versions/node/8.0.0/bin/node /usr/bin/node
How do I update Node.js?
Related
I have an Ubuntu box with node - v 9.5.0 and npm - 5.6.0 versions. I am trying to use expressjs (http://expressjs.com), but unable to run it. It works fine for node v 4.x.x.
$ express -h
module.js:557
throw err;
^
Error: Cannot find module 'commander'
at Function.Module._resolveFilename (module.js:555:15)
at Function.Module._load (module.js:482:25)
at Module.require (module.js:604:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/usr/lib/nodejs/express-generator/bin/express:3:15)
at Module._compile (module.js:660:30)
at Object.Module._extensions..js (module.js:671:10)
at Module.load (module.js:573:32)
at tryModuleLoad (module.js:513:12)
at Function.Module._load (module.js:505:3)
What is it that I am missing here?
Ubuntu's packages seem to be outdated.
Installing using apt-get node-express-generator gives this error.
Installing using npm i -g express-generator works fine.
Please try to follow the preceding steps.
Install the current version of NodeJS
Uninstall all modules with npm uninstall and rm -fr ~/.npm
Reinstall express-generator
Hope it helps.
I am unable to resolve this error. I don't even know what's causing it. I have the latest version of npm and the most stable version of node.
$ nvm use 0.10.40
/Users/Test/.nvm/v0.10.40/lib/node_modules/npm/lib/utils/unsupported.js:27
console.error(`a bug known to break npm. Please update to at least ${r
^
SyntaxError: Unexpected token ILLEGAL
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 Module.require (module.js:364:17)
at require (module.js:380:17)
at /Users/Test/.nvm/v0.10.40/lib/node_modules/npm/bin/npm-cli.js:19:21
at Object.<anonymous> (/Users/Test/.nvm/v0.10.40/lib/node_modules/npm/bin/npm-cli.js:92:3)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
nvm is not compatible with the npm config "prefix" option: currently set to ""
Run npm config delete prefix or nvm use --delete-prefix v0.10.40 to unset it.
I tried to run nvm use --delete-prefix v0.10.40 but that gives me the same error as well.
You probably need up update Node.js which you can do by visiting
https://nodejs.org/en/
See:
https://github.com/npm/npm/issues/18963
Update your nodejs version, install the nvm https://github.com/creationix/nvm.
Later install the version choice of nodejs
# e.g, replace for a current version
nvm install 9.3.0
Following the instructions for initial setup I stucked when found a red screen with:
ReferenceError: Can't find variable: __fbBatchedBridge (line 1 in the
generated bundle)
After reloading it changes and becomes:
Unable to download JS bundle
Than I found an advice for typing react-native start into the console. The result:
react-native start
/local/react_native/android_program1/node_modules/react-native/local-cli/cli.js:74 const setupEnvScript = /^win/.test(process.platform) ^^^^^
SyntaxError: Use of const in strict mode.
at Module._compile (module.js:439:25)
at Module._extensions..js (module.js:474:10)
at Object.require.extensions.(anonymous function) [as .js] (/local/react_native/android_program1/node_modules/react-native/node_modules/babel-core/node_modules/babel-register/lib/node.js:142:7)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object. (/local/react_native/android_program1/node_modules/react-native/cli.js:15:18)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
I'm using:
RHEL 7, npm 1.3.6, nodejs 0.10.36 and react-native 0.19.
How can I make it work?
install node js
open command promt.
type: react-native init projectName
this command will automatically download all the required dependancies for project.
open the directory from cmd using cd projectname
react-native run-android
if u face the error like : make sure you have npm install.
then just exicute this command
npm install --save
your project will run successfully.
hope it work for you..
I'm trying to install React-native to my ubuntu 14.04. I have sucessfully installed react-native-cli, but when I'm trying to run react-native init reactApp trene is an error:
pavlov#pavlov-System-Product-Name:~$ node -v
v0.12.7
pavlov#pavlov-System-Product-Name:~$ react-native init reactApp
prompt: Directory reactApp already exist. Continue?: (no) y
This will walk you through creating a new React Native project in /home/pavlov/reactApp
Installing react-native package from npm...
You are currently running Node v0.12.7 but React Native requires >=4. Please use a supported version of Node.
See https://facebook.github.io/react-native/docs/getting-started.html
/home/pavlov/reactApp/node_modules/react-native/local-cli/cli.js:56
const setupEnvScript = /^win/.test(process.platform)
^^^^^
SyntaxError: Use of const in strict mode.
at exports.runInThisContext (vm.js:73:16)
at Module._compile (module.js:443:25)
at Module._extensions..js (module.js:478:10)
at Object.require.extensions.(anonymous function) [as .js] (/home/pavlov/reactApp/node_modules/babel-core/lib/api/register/node.js:214:7)
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> (/home/pavlov/reactApp/node_modules/react-native/cli.js:15:18)
at Module._compile (module.js:460:26)
How can i fix it?
You definitely need to install Node 4.0 or higher. Actually it even says it in your console output.
Here is how i installed Node on my Ubuntu:
sudo apt-get install curl
curl --silent --location https://deb.nodesource.com/setup_4.x | sudo bash -
sudo apt-get install nodejs
Good luck!
Go to https://nodejs.org/en/ and download the latest version, in this case v4.4.3.
After upgrading the nodejs version running on my Openshift's gear from v0.10 to v0.12, I get the following error:
Error: /app-root/runtime/repo/node_modules/bcrypt/build/Release/bcrypt_lib.node: undefined
symbol: node_module_register
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at bindings (/app-root/runtime/repo/node_modules/bcrypt/node_modules/bindings/bindings.js:76:44)
at Object.<anonymous> (/app-root/runtime/repo/node_modules/bcrypt/bcrypt.js:3:35)
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)
The bcrypt version in my package.json is set to ~0.8.5.
So far I have tried these without success:
- rhc ssh myapp then update node-gyp, rm -rf node_modules and npm install;
- manually installed the dependencies;
- edited package.json to preinstall node-gyp
"scripts":{
"preinstall": "npm i -g node-gyp && node-gyp clean"
}
anyone has an idea / knows on how I can solve this? (ideally the solution won't require to upgrade gcc)
Also, I am using Ryan J's custom cartridge for nodejs v.012
I finally solved it with a workaround by editing .openshift\lib\utils and adding export OPENSHIFT_NODEJS_VERSION=0.6 in the setup_path_for_custom_node_version() function:
# Add the node binary path to the PATH.
export OPENSHIFT_NODEJS_VERSION=0.6
export PATH="$node_bin_path:${PATH}"