跟着官方示例,走不下去了


(q414625852) #1

走到了 npm init 这一步:出现如下错误:

> npm install
Password:

sluff-lib@0.4.6 postinstall /Users/yangyoucun/Desktop/sluff-sdk-mac-0.0.1/examples/test/node_modules/sluff-lib
npm run sluff-compile-lib


sluff-lib@0.4.6 sluff-compile-lib /Users/yangyoucun/Desktop/sluff-sdk-mac-0.0.1/examples/test/node_modules/sluff-lib
if [ -d ./src ]; then 6to5 -l es6.modules -d lib/ src/; fi

node: bad option: --nowarn_template_set

npm ERR! Darwin 15.3.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "sluff-compile-lib"
npm ERR! node v7.0.0
npm ERR! npm  v4.0.3
npm ERR! code ELIFECYCLE
npm ERR! sluff-lib@0.4.6 sluff-compile-lib: `if [ -d ./src ]; then 6to5 -l es6.modules -d lib/ src/; fi`
npm ERR! Exit status 9
npm ERR!
npm ERR! Failed at the sluff-lib@0.4.6 sluff-compile-lib script 'if [ -d ./src ]; then 6to5 -l es6.modules -d lib/ src/; fi'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the sluff-lib package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     if [ -d ./src ]; then 6to5 -l es6.modules -d lib/ src/; fi
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs sluff-lib
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls sluff-lib
npm ERR! There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/yangyoucun/Desktop/sluff-sdk-mac-0.0.1/examples/test/node_modules/sluff-lib/npm-debug.log
npm ERR! Darwin 15.3.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v7.0.0
npm ERR! npm  v4.0.3
npm ERR! code ELIFECYCLE

npm ERR! sluff-lib@0.4.6 postinstall: `npm run sluff-compile-lib`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sluff-lib@0.4.6 postinstall script 'npm run sluff-compile-lib'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the sluff-lib package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     npm run sluff-compile-lib
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs sluff-lib
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls sluff-lib
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/yangyoucun/Desktop/sluff-sdk-mac-0.0.1/examples/test/npm-debug.log

(coolers) #2

看样子你需要一个更新版本的nodejs。
nodejs 需要 v6,建议v6.4.0+


(coolers) #3

and~

如果你需要在nodejs v7里面尝试的话,建议你用vi把下面的这个文件:

/usr/local/bin/6to5

中的第一行里的

–nowarn_template_set

删除掉试试。


(q414625852) #4

我是用的node -7,但是去掉--nowarn_template_set的时候,重新npm install出现了其他错误:

sluff-lib@0.4.6 postinstall /Users/yangyoucun/Desktop/sluff-sdk-mac-0.0.1/examples/test/node_modules/sluff-lib
npm run sluff-compile-lib


sluff-lib@0.4.6 sluff-compile-lib /Users/yangyoucun/Desktop/sluff-sdk-mac-0.0.1/examples/test/node_modules/sluff-lib
if [ -d ./src ]; then 6to5 -l es6.modules -d lib/ src/; fi




 Fatal error in ../deps/v8/src/api.cc, line 1051
Check failed: !value_obj->IsJSReceiver() || value_obj->IsTemplateInfo().


==== C stack trace ===============================

    0   node                                0x0000000100b8db23 v8::base::debug::StackTrace::StackTrace() + 19
    1   node                                0x0000000100b8aca9 V8_Fatal + 233
    2   node                                0x0000000100147cfa v8::Template::Set(v8::Local<v8::Name>, v8::Local<v8::Data>, v8::PropertyAttribute) + 330
    3   fse.node                            0x00000001020eff4d fse::FSEvents::Initialize(v8::Local<v8::Object>) + 197
    4   node                                0x00000001009ce0bc node::DLOpen(v8::FunctionCallbackInfo<v8::Value> const&) + 854
    5   node                                0x000000010017c59a v8::internal::FunctionCallbackArguments::Call(void (*)(v8::FunctionCallbackInfo<v8::Value> const&)) + 378
    6   node                                0x00000001001e029c v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<false>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, v8::internal::BuiltinArguments) + 924
    7   node                                0x00000001001df6d9 v8::internal::Builtin_Impl_HandleApiCall(v8::internal::BuiltinArguments, v8::internal::Isolate*) + 281
    8   ???                                 0x00000c46542063a7 0x0 + 13496198652839
    9   ???                                 0x00000c46544c6c7a 0x0 + 13496201538682
sh: line 1: 49167 Illegal instruction: 4  6to5 -l es6.modules -d lib/ src/


(q414625852) #5

换回了node 6.2版本,已经好了,谢谢啦


(kenshin) #6

您好,目前我们还没有为 node7 做针对性兼容处理,请先用 node 6体验。 我们会尽快提供 node7 的支持