相关疑难解决方法(0)

我如何更新Node.js?

我做了以下更新我的npm:

npm update npm -g
Run Code Online (Sandbox Code Playgroud)

但我不知道如何更新Node.js. 有什么建议?(我正在使用Node.js 0.4.1并希望更新到Node.js 0.6.1.)

software-update node.js

743
推荐指数
20
解决办法
160万
查看次数

可以在纯JavaScript中实现只读属性吗?

查看mozilla文档,查看正则表达式示例(标题为"使用匹配结果创建数组"),我们有以下语句:

input:一个只读属性,它反映与正则表达式匹配的原始字符串.

index:只读属性,是字符串中匹配的从零开始的索引.

etc ...是否可以在JavaScript中创建自己的对象,该对象具有只读属性,或者这是特定浏览器实现的内置类型的特权?

javascript browser

43
推荐指数
4
解决办法
3万
查看次数

SyntaxError:在严格模式下使用const?

我想用selenium-webdriver登录facebook.com.

var webdriver = require('selenium-webdriver'),
    By = require('selenium-webdriver').By,
    until = require('selenium-webdriver').until;

var driver = new webdriver.Builder()
    .forBrowser('firefox')
    .build();

driver.get('https://www.facebook.com/login');
driver.findElement(By.id('email')).sendKeys('****');
driver.findElement(By.id('pass')).sendKeys('*****');
driver.findElement(By.id('loginbutton')).click();

driver.findElement(By.linkText('Settings')).then(function(element) {
  console.log('Yes, found the element');
}, function(error) {
  console.log('The element was not found, as expected');
});
driver.quit();
Run Code Online (Sandbox Code Playgroud)

这是错误的:

/home/shubham/node_modules/selenium-webdriver/index.js:25
const builder = require('./builder');
^^^^^
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> (/home/shubham/Music/amazon_login/test_22_4_16/sel_login.js:1:79)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js …
Run Code Online (Sandbox Code Playgroud)

selenium node.js selenium-webdriver

42
推荐指数
2
解决办法
11万
查看次数

Visual Studio Task Runner"SyntaxError:在严格模式下使用const."

使用Win10 Pro/VS2015和'网站'项目(不是asp.net,基本网站)

当尝试保存/重新加载gulpfile.js时,我收到错误消息(来自Task Runner Explorer /输出)

SyntaxError:在严格模式下使用const.

在目前的情况下,它正在窒息'gulp-changed'

我查看了可用的答案和评论:


在我的情况下,环境路径,$(PATH)已经包含节点的全局安装,但我需要将它移到$(DevEnvDir)路径之前,以便它将获得优先级. 在我的情况下,环境路径,$(PATH)已经包含节点的全局安装,但我需要将它移到$(DevEnvDir)路径之前,以便它将获得优先级.

(在提供正确答案后添加,谢谢@baao)

javascript node.js gulp

7
推荐指数
1
解决办法
2560
查看次数

赫斯基给出错误SyntaxError:在严格模式下使用const

我正在使用赫斯基Lint-stagedStylelint

  "scripts": {
    "precommit": "lint-staged",

  },
  "lint-staged": {
    "*.scss": ["stylelint --syntax scss"
    ]
  },
Run Code Online (Sandbox Code Playgroud)

OS - 最新的OSX

节点 - 6.10.0

NPM - 3.10.00

我收到了这个错误 git commit

> husky - npm run -s precommit

/Users/jitendravyas/app/node_modules/lint-staged/src/index.js:6
const path = require('path')
^^^^^
SyntaxError: Use of const in strict mode.
    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 Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (/Users/jitendravyas/app/node_modules/lint-staged/index.js:2:1)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js …
Run Code Online (Sandbox Code Playgroud)

git node.js stylelint husky lint-staged

3
推荐指数
1
解决办法
2163
查看次数

在严格模式下使用 const :Azure Web App

Application has thrown an uncaught exception and is terminated: SyntaxError: Use of const in strict mode.
    at Module._compile (module.js:434:25)
    at Object..js (module.js:464:10)
    at Module.load (module.js:353:31)
    at Function._load (module.js:311:12)
    at Module.require (module.js:359:17)
    at require (module.js:375:17)
    at Object.<anonymous> (D:\home\site\wwwroot\node_modules\mongoose\index.js:7:18)
    at Module._compile (module.js:446:26)
    at Object..js (module.js:464:10)
    at Module.load (module.js:353:31)
Run Code Online (Sandbox Code Playgroud)

每次创建 Azure Web App 项目并发布 Express App 时都会引发错误。我尝试使用 Azure Express 以及 Blank nodeJs App 来做到这一点

azure node.js azure-web-app-service

2
推荐指数
1
解决办法
1446
查看次数