How to resolve such issue 'no such environment: Default 'when' NPM install'

Source: Internet
Author: User

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 built'
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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.