zoukankan      html  css  js  c++  java
  • 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)

  • 相关阅读:
    【分享】如何给视频码流添加PTS和用户自定义信息
    【分享】在MPSoC ZCU106单板的HDMI-Tx上基于eglfs_kms的运行QT应用程序
    检查Linux DRM显示设备ID的脚本
    【分享】更新的 AXI performance monitors (APM)测试工具
    window下安装clickhouse
    计算机组成原理学习
    FX DocuCentre S2110富士施乐打印机驱动
    打开网站出现Service Unavailable错误解决方法
    Java高德地图两点间距离、地理编码、逆地理编码
    IDEA运行Main报错Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.6.0:exec (default-cli) on project education: Command execution failed.
  • 原文地址:https://www.cnblogs.com/limei/p/2178519.html
Copyright © 2011-2022 走看看