• How to resolve such issue 'no such environment: default' when 'npm install' dependencies Anny


    I met such issue 'no such environment: default'  when npm install some libs, such as iconv, hashlib...

    The workround is to modify /usr/local/lib/node/wafadmin/Build.py like below:

    def get_env(self):
            return self.env_of_name(DEFAULT)

    The original is like

    def get_env(self):
            return self.env_of_name('default')

    The issue is like below:

    > node-expat@1.4.0 install /usr/local/lib/node_modules/xml2js-expat/node_modules/node-expat
    > node-waf configure build

    Checking for program g++ or c++          : /usr/bin/g++
    Checking for program cpp                 : /usr/bin/cpp
    Checking for program ar                  : /usr/bin/ar
    Checking for program ranlib              : /usr/bin/ranlib
    Checking for g++                         : ok 
    Checking for node path                   : not found
    Checking for node prefix                 : ok /usr/local
    Checking for header expat.h              : no such environment: default
    Traceback (most recent call last):
      File "/usr/local/bin/node-waf", line 16, in <module>
        Scripting.prepare(t, os.getcwd(), VERSION, wafdir)
      File "/usr/local/bin/../lib/node/wafadmin/Scripting.py", line 145, in prepare
        prepare_impl(t, cwd, ver, wafdir)
      File "/usr/local/bin/../lib/node/wafadmin/Scripting.py", line 135, in prepare_impl
        main()
      File "/usr/local/bin/../lib/node/wafadmin/Scripting.py", line 188, in main
        fun(ctx)
      File "/usr/local/bin/../lib/node/wafadmin/Scripting.py", line 241, in configure
        conf.sub_config([''])
      File "/usr/local/bin/../lib/node/wafadmin/Configure.py", line 221, in sub_config
        self.recurse(k, name='configure')
      File "/usr/local/bin/../lib/node/wafadmin/Utils.py", line 634, in recurse
        f(self)
      File "/usr/local/lib/node_modules/xml2js-expat/node_modules/node-expat/wscript", line 13, in configure
        errmsg = "not installed")
      File "/usr/local/bin/../lib/node/wafadmin/Tools/config_c.py", line 444, in check
        ret = self.run_c_code(*k, **kw)
      File "/usr/local/bin/../lib/node/wafadmin/Tools/config_c.py", line 521, in run_c_code
        o = bld(features=kw['features'], source=test_f_name, target='testprog')
      File "/usr/local/bin/../lib/node/wafadmin/Build.py", line 343, in __call__
        return TaskGen.task_gen(*k, **kw)
      File "/usr/local/bin/../lib/node/wafadmin/TaskGen.py", line 118, in __init__
        self.env = self.bld.env.copy()
    AttributeError: 'NoneType' object has no attribute 'copy'
    npm ERR! forced, continuing Error: node-expat@1.4.0 install: `node-waf configure build`
    npm ERR! forced, continuing `sh "-c" "node-waf configure build"` failed with 1
    npm ERR! forced, continuing     at ChildProcess.<anonymous> (/home/xxx/Downloads/package/lib/utils/exec.js:49:20)
    npm ERR! forced, continuing     at ChildProcess.emit (events.js:67:17)
    npm ERR! forced, continuing     at ChildProcess.onexit (child_process.js:192:12)

  • 相关阅读:
    Sublime Text3 无法调出package controll问题
    Python标准库-enumerate用法
    设计模式学习-简单工厂模式(python3)
    【IO流】java中文件路径(相对路径、绝对路径)相关类及方法
    nginx安装教程(详细)
    nginx -stream(tcp连接)反向代理配置 实现代理mysql以及文件上传
    【单例模式】懒汉式的线程安全问题 volatile的作用
    jsonp协议 java服务端、JQuery客户端 简单实现原理
    MyBatis原理,Spring、SpringBoot整合MyBatis
    【JavaSE】运行时类型信息(RTTI、反射)
  • 原文地址:https://www.cnblogs.com/limei/p/2178519.html
Copyright © 2020-2023  润新知