Tag Archives: javascript

Local workspace file (‘angular.json’) could not be found.

The following error was reported while running ng serve

Local workspace file ('angular.json') could not be found.
Error: Local workspace file ('angular.json') could not be found.
    at WorkspaceLoader._getProjectWorkspaceFilePath (D:\nodejs\node_global\node_modules\@angular\cli\models\workspace-loader.js:44:
19)
    at WorkspaceLoader.loadWorkspace (D:\nodejs\node_global\node_modules\@angular\cli\models\workspace-loader.js:31:21)
    at ServeCommand._loadWorkspaceAndArchitect (D:\nodejs\node_global\node_modules\@angular\cli\models\architect-command.js:201:32)
    at ServeCommand.<anonymous> (D:\nodejs\node_global\node_modules\@angular\cli\models\architect-command.js:53:25)
    at Generator.next (<anonymous>)
    at D:\nodejs\node_global\node_modules\@angular\cli\models\architect-command.js:7:71
    at new Promise (<anonymous>)
    at __awaiter (D:\nodejs\node_global\node_modules\@angular\cli\models\architect-command.js:3:12)
    at ServeCommand.initialize (D:\nodejs\node_global\node_modules\@angular\cli\models\architect-command.js:52:16)
    at Object.<anonymous> (D:\nodejs\node_global\node_modules\@angular\cli\models\command-runner.js:127:23)

Error cause: Possible angular/ CLI version mismatch
Solutions:
Upgrade presents/cli
Uninstall Angular/CLI globally

npm uninstall -g @angular/cli

2. Clean up

npm cache verify

Install Angular/CLI globally

npm install -g @angular/cli@latest

4. Uninstall Angluar/CLI under the project path

npm uninstall --save-dev @angular/cli

5. Install under the project path:

npm install --save-dev @angular/[email protected]

6. NPM install or YARN Install under the project path
7. Fix the problem after NPM installation:

npm audit fix

8. Resolve “Angular. Json” related issues:

ng update @angular/cli --migrate-only --from=1.4.9

 

Reproduced in: https://www.cnblogs.com/shira-t/p/9759142.html

Failed to load resource: net::ERR_CONNECTION_RESET

Failed to load resource: net::ERR_CONNECTION_RESET
init.js:568 Uncaught TypeError: Unable read property ‘_getInfo’ of undefined

reported two consecutive errors. After baidu, I found that the problem was caused by the failure of a resource loading in the page, but I refreshed the page before opening the chrome developer tool. This error occurs when the developer tool loads the cache and the resource is not found. If you open the developer tool and then refresh it, the error will not be reported.
The answer here: https://zhidao.baidu.com/question/1385177154063329420.html
Failed to load the resource: net: : ERR_CACHE_MISS developer tools into the cache, said can’t find the resources.
the problem is that you open the page before you open chrome’s developer tools. The page itself is set to no-store without cache, so developer tools opened by the latter cannot reach the cache.
if you have already opened developer tools, refresh again will not have this error

VUEJS Failed to execute ‘removeChild’ on ‘Node’: The node to be removed is not a child of

Failed to execute ‘removeChild’ on ‘Node’ : The Node to be removed is not a child of this Node.

in my previous post
VUEJS project practice 5 Dialog pop-up box MessageBox (very nice bootstrap style)
has introduced a MesageBox style combined with bootstrap style
Then in the previous post
VUEJS project practice 4 custom keyboard instructions (keystrokes to get focus)
introduced a way for keystrokes to automatically get focus and trigger events.
Now when MessageBox binds Enter, an error
messagebox.vue?Cb02 :80 Uncaught DOMException: Failed to execute ‘removeChild’ on ‘Node’ : The Node to be removed is not a child of this Node.

First post the message.vue file

<template>
  <div v-key-bind-listen>
      <div class="msgBox" v-show="isShowMessageBox">
        <div class="msgBox_header">
          <div class="msgBox_title">
            <h3>{{ title }}</h3>
          </div>
        </div>

        <div class="msgBox_content">
          <p>{{ content }}</p>
        </div>

        <div class="msgBox_btns">
          <button type="button" class="btn btn-lime btn-lg" id="confirmBtn" @click="confirm"  bind_key="ENTER">确定</button>
          <button type="button" class="btn btn-dark btn-lg" id="cancelBtn" @click="cancel"  bind_key="ESC">取消</button>

        </div>

      </div>
  </div>
</template>

<script>
  export default {
    name: 'messageBox',
    data(){
      return {
        title: '',
        content: '',
        isShowMessageBox: false,
        resolve: '',
        reject: '',
        promise: '' // 保存promise对象
      }
    },
    methods: {
      close(state){
        this.model.show = false;
        if(this.model.callback){
          this.model.callback(state);
        }
      },
    // 确定,将promise断定为resolve状态
    confirm: function () {
      this.isShowMessageBox = false;
      this.resolve('confirm');
      this.remove();
    },
    // 取消,将promise断定为reject状态
    cancel: function () {
      this.isShowMessageBox = false;
      this.reject('cancel');
      this.remove();
    },
    // 弹出messageBox,并创建promise对象
    showMsgBox: function () {
      this.isShowMessageBox = true;
      this.promise = new Promise((resolve, reject) => {
        this.resolve = resolve;
        this.reject = reject;
      });
      // 返回promise对象
      return this.promise;
    },
    remove: function () {
      setTimeout(() => {
        this.destroy();
      }, 300);
    },
    destroy: function () {
      this.$destroy();
      document.body.removeChild(this.$el);
    }
  }
  }
</script>

<style scoped>
  .msgBox {
    position: fixed;
    z-index: 4;
    left: 50%;
    top: 35%;
    transform: translateX(-50%);
    width: 420px;
    background-color: black;
    opacity: 0.55;
  }

  .msgBox_header {
    padding: 20px 20px 0;
  }

  .msgBox_title {
    padding-left: 0;
    margin-bottom: 0;
    font-size: 26px;
    font-weight: 800;
    height: 18px;
    color: #fff;
  }

  .msgBox_content {
    padding: 30px 20px;
    color: #fff;
    font-size: 18px;
    font-weight: 200;
  }

  .msgBox_btns {
    padding: 10px 20px 15px;
    text-align: right;
    overflow: hidden;
  }

  @keyframes show-messageBox {
    from {
      opacity: 0;
    }
    to {
      opacity: 1;

    }
  }

  @keyframes bounce-in {
    from {
      opacity: 0;
    }
    to {
      opacity: 1;

    }
  }


</style>

The V-key-bind-listen instruction defined here is used for key listening. For details, please refer to the previous blog. It would be boring to write it again.
VUEJS project practice four custom keyboard commands (keys to get focus)
When you press ESC to cancel, there is no problem
when you press ENTER to confirm, the error will appear in the newspaper
messagebox.vue?Cb02:80 Uncaught DOMException: Failed to execute ‘removeChild’ on ‘Node’ : The Node to be removed is not a child of this Node.
Error is located via console.

>
add a line of logs in the destroy method. The console prints this.$el.

console.log(this.$el)

Add a line of logs to determine if this.$el is a child of the body

console.log(document.body.contains(this.$el))

MongoNetworkError: failed to connect to server [localhost:27017]

MongoNetworkError: failed to connect to server [localhost:27017] on first connect [MongoNetworkError: connection 0 to localhost:27017 timed out
    at Socket.<anonymous> (D:\Desktop\node\mongodblearn\07_student_list\node_modules\mongodb\lib\core\connection\connection.js:355:7)     
    at Object.onceWrapper (events.js:427:28)
    at Socket.emit (events.js:321:20)
    at Socket._onTimeout (net.js:478:8)
    at listOnTimeout (internal/timers.js:549:17)
    at processTimers (internal/timers.js:492:7) {
  name: 'MongoNetworkError'
}]
    at Pool.<anonymous> (D:\Desktop\node\mongodblearn\07_student_list\node_modules\mongodb\lib\core\topologies\server.js:438:11)
    at Pool.emit (events.js:321:20)
    at D:\Desktop\node\mongodblearn\07_student_list\node_modules\mongodb\lib\core\connection\pool.js:562:14
    at D:\Desktop\node\mongodblearn\07_student_list\node_modules\mongodb\lib\core\connection\pool.js:995:11
    at callback (D:\Desktop\node\mongodblearn\07_student_list\node_modules\mongodb\lib\core\connection\connect.js:97:5)
    at D:\Desktop\node\mongodblearn\07_student_list\node_modules\mongodb\lib\core\connection\connect.js:124:7
    at _callback (D:\Desktop\node\mongodblearn\07_student_list\node_modules\mongodb\lib\core\connection\connect.js:349:5)
    at Connection.errorHandler (D:\Desktop\node\mongodblearn\07_student_list\node_modules\mongodb\lib\core\connection\connect.js:365:5)   
    at Object.onceWrapper (events.js:428:26)
    at Connection.emit (events.js:321:20) {
  name: 'MongoNetworkError'
}

The above error indicates that Mongodb is not started

Ineffective mark-compacts near heap limit Allocation failed – JavaScript heap out of memory

1. problem description.
At present, when compressing the front-end code, there are memory leaks in the nodes, errors as follows: invalid marker – collating nearby heap limit allocation failure – JavaScript heap memory
2. The errors are as follows.

Warning: callback based version of packager() has been deprecated and will be removed from future major releases, please convert to committed version or use nodeify module.
Packager application for win32 ia32 platform, using ev4.0.5
—last few times–>
ms: Mark-sweep 1294.7 (1425.0) -> 1294.7 (1425.5) MB, 1723.7/0.0 ms (average mu = 0.094, current mu = 0.000) last resort GC requests for old space
[23328:00000202C8E3E9D0] 11281890 ms: marker scan 1295.7 (1425.5)->1294.7 (1426.5) MB, 1734.9/0.0 ms (average mu = 0.101, current mu = 0.108) assignment failure clearance may not be successful

<- JS stacktrace ->

0: ExitFrame [pc: 000003C6B7315600]
Security context: 0x01457ba9e6e1 <JSObject>
1: access [0000031C1EB050F9] [fs]js: ~ 167] [pc = 000003 c6b7319b09] (= 0 x01dd68b04d69 & lt;object mapping = 00000232 d8c16af9>, = 0 x00b368108379 & lt;path string[737]:E: \pacs-consultation-electron-meeting \ node_modules \ stompjs \ node_modules \ websocket \\ node_modules \ es5-ext \ node_modules \ es6-iterator \ node_modules \ d\ node_modules \ es5-ext \ node_modules \ es6-iterator \ node_modules \ es6-iterator \ node_modules \ es6-iterator node__……
Fatal error: Invalid marker – failed collation nearby heap limit allocation – JavaScript heap memory
1: 00007 ff67be308aa v8: Internal:GCIdleTimeHandler: GCIdleTimeHandler + 4810
2: 00007 ff67be09c46 node:MakeCallback + 4518
3: 00007 ff67be0a630 node_module_register + 2160
4: 00007 ff67c09aa4e v8: Internal:FatalProcessOutOfMemory + 846
5: 00007 ff67c09a97f v8:Internal:FatalProcessOutOfMemory + 639
6: 00007 ff67c5d8984 v8:internal:heap:MaxHeapGrowingFactor + 11476
7:00007 ff67c5cf0e7 v8::internal::ScavengeJob::operator= + 25543
8: 00007 ff67c5cd65c v8:Internal:ScavengeJob::operator= + 18748
9: 00007 ff67c5d65d7 v8:Internal:Heap:MaxHeapGrowingFactor + 2343
10: 00007 ff67c5d6656 v8:Internal:Heap:MaxHeapGrowingFactor + 2470
11: 00007 ff67c1790db v8:Internal::Factory::AllocateRawWithImmortalMap + 59
12: 00007 ff67c17ba9d v8:Internal::Factory::NewRawOneByteString + 77
13: 00007 ff67c38fbc4 v8: Internal:Heavy:SmiPrint + 372
14:00007FF67C08DF5B v8::internal::StringHasher::UpdateIndex+219
15: 00007FF67C0B44CB v8::WriteUtf8+171
16: 00007FF67BD3F1A0 std::basic_ostream<:operator< +40912
17: 00007FF67BDC9B92 uv_loop_fork+13762
18: 000003c6b7315600
npm ERR!Code ELIFECYCLE
npm ERR!er!pac – electronic [email protected] build:win32: ‘ cross-env BUILD_TARGET=win32 node .electron-vue/build. js ‘
npm made a mistake! Exit Status 134
npm ERR!
npm ERR! In pac – electronic [email protected]构建:win32脚本中失败.
npm made an error! This may not be a problem with npm. There may be additional log output above.
npm made an error! The full log of this run can be found in the following file:
npm ERR!C:\Users\boyi08\AppData\Roaming\npm-cache\_logs\ 2020 – 02 – 25 – t04_43_09_617z debug.log
3. Solutions
Programme I.
In the package. inside the json: add this sentence:–max_old_space_size = 8192 // or max_old_space_size = 4096 (it is recommended to set to 4 g to see, if not set to 8 g)
“script”: {
“dev”: “node build/dev-server.” “start”: “node build/dev-server.” node -max_old_space_size=8192 build/build”.
“build”: “node -max_old_space_size=8192 build/build. js ”
},
Programme 2.
Delete the npmrc file (not the npmrc file in the nodejs installation directory under the npm module, but the .npmrc file in C: \\user\{account}\).

Uncaught TypeError: Failed to execute ‘appendChild’ on ‘Node’: parameter 1 is not of type ‘Node How to Fix

I want to dynamically insert a line of data into tBody, and I write the following code:

html:
        <table id="theList">
        <thead>
            <th>姓名</th>
            <th>年龄</th>
            <th>性别</th>
            <th>操作</th>
        </thead>
        <tbody id="myBody"></tbody>
    </table>


js:

let list = []
let temp = []

list.push({
    name: '张三',
    age: 20,
    sex: '男'
})
list.push({
    name: '赵四',
    age: 19,
    sex: '女'
})
function render(data) {
    var html=[]
    for (let i = 0; i < data.length; i++) {
        let template = '<tr><td>'+data[i].name+'</td><td>'+data[i].age+'</td><td>'+data[i].sex+'</td><td><a href="javascript:;">修改</a>&nbsp;&nbsp;<a href="javascript:;">删除</a></td></tr>'
        html.push(template)
                                    document.getElementById('myBody').appendChild(html.join(''))
    } 
}
render(list)

The browser throws an Uncaught TypeError when running the above code: Failed to execute ‘appendChild’ on ‘Node’ : parameter 1 is not of type ‘Node’. To find out the cause of the error by looking up data:
AppendChild () requires that a tr object be passed in, not a tr string
and html.join(“) above is a string

console.log(typeof html.join(''))  //stirng

Solution:
render function

function render(data) {
    for (let i = 0; i < data.length; i++) {
        let tr = document.createElement('tr')
        tr.innerHTML = '<td>'+data[i].name+'</td><td>'+data[i].age+'</td><td>'+data[i].sex+'</td><td><a href="javascript:;">修改</a>&nbsp;&nbsp;<a href="javascript:;">删除</a></td>'
        document.getElementById('myBody').appendChild(tr)
    } 
}

Tr is an object. Instead of writing like this, you might as well just write:

function render(data) {
    var html=[]
    for (let i = 0; i < data.length; i++) {
        let template = '<tr><td>'+data[i].name+'</td><td>'+data[i].age+'</td><td>'+data[i].sex+'</td><td><a href="javascript:;">修改</a>&nbsp;&nbsp;<a href="javascript:;">删除</a></td></tr>'
        html.push(template)
        document.getElementById('myBody').innerHTML = html.join('')
    } 
}

Operation effect:

Other features are still being implemented… .

ASP.NET AJAX client-side framework failed to load


======================================================

note: source code click here to download

======================================================

Asp.net ajax client-side framework failed to load

posted on 2011-08-09 00:04 Leo. W read (30) comments (0) edit collection

development environment from xp upgrade to 64-bit 2008 or windows7,iis change to 7.0, encountered various problems

encountered the same problem, various errors

1 webform_autofocus(“”) missing object

2 asp.net ajax client framework failed to load

solution application pool, advanced Settings, with 32-bit applications enabled set to true.

everything is ok.

depressed colleagues also default installation, I do not know how to set to false, made me crazy for two days!!

tag: ajax client-side

green channel: good text to focus on my collection this article with me to contact

registered users can only post comments after logging in, please log in or register, return to the homepage of the blog garden.

home blog ask flash news garden recruitment knowledge base

latest it news :

·android platform surpassed ios

in advertising browsing share in December with 51.6%
· ios beta source code shows that iPad 3 May support siri

· Stephen Hawking’s new computer

· jingdong mall won a piece of Beijing’s commercial land with 295 million yuan

· American newspaper giants cooperate with facebook Google media attach importance to network network

» more news…

latest knowledge base article :

·javascript object-oriented programming

· continuous integration of “everything is code”

· continuously integrated “software self-recognition”

· continuous integration play-word check-in dance

· what is a closure.
my understanding

» more knowledge base articles…

Textbook touring exhibition in autumn 2011

China -pub out of print computer books on demand service

======================================================

in the end, I invite you to participate in sina APP, sina is a free to give you a space, support PHP+MySql, free secondary domain name, free domain name binding this is the address I invited, you register through this link is my friend, and get a gift of 500 yundou, worth 5 yuan! The station I created has more than 2000 visitors per day, and I can earn 50+ yuan per day by hanging advertisements. Oh, (^o^)/

Uncaught domexception: failed to read the ‘contentdocument’ property from ‘htmliframeelement’

1 problem found

recently developed Excel import and export tools, greatly improving the work efficiency, complacent. However, when the project was deployed in a test environment, it was found that the file could not be uploaded in chrome, and the log reported the following error:

Uncaught DOMException: Failed to read the 'contentDocument' property from 'HTMLIFrameElement': Blocked a frame with origin "http://xx.xx.xxx.xxx:8081 " from accessing a cross-origin frame.   

at HTMLIFrameElement.<anonymous>http://xx.xx.xxx.xxx:8081/static-v1.0.0/dwz/js/dwz.ajax.js:76:20    
at HTMLIFrameElement.dispatch http://xx.xx.xxx.xxx:8081/static-v1.0.0/dwz/js/jquery-2.1.4.min.js:3:6466 )   
at HTMLIFrameElement.r.handle http://xx.xx.xxx.xxx:8081/static-v1.0.0/dwz/js/jquery-2.1.4.min.js:3:3241 

2 analysis
The

read prompt is an exception that occurs when you fetch the iframe’s contentDocument. This exception is usually due to the browser’s same-domain readable and writeable policy, which is cross-domain readable but not writeable.

but we’re all in the same project and we’re all calling actions in the same field, so let’s put a breakpoint here and look at the actual iframe:

found this baseURI problem, the normal address should be the corresponding module URI, such as:
http://xxx/base/index#/xxx/table, but the address here is the previous module URL (no use of Excel import and export tools), that is, the browser did not recognize the URL of the new page.

looks at the code and finds that in the generic freemarker page it says:

action="${contextPath}/${importUrl}"

and the URL passed in is:

"/xxx/importExcel"

combined address is:

//xxx/importExcel

did you notice that there was an extra / in front of it, which caused the browser’s frame not to recognize this address!

3 address

remove this extra /, it’s ok to O(∩_∩)O~

Asynchronous loading JS does not allow the use of document write solution

asynchronous loading js does not allow the use of document write solution

to recommend a cat smoking website: love cat family (http://15cat.com), I hope you like


var scriptFile = document.createElement('script');

scriptFile.setAttribute("type","text/javascript");

scriptFile.setAttribute("src",'http://api.map.baidu.com/api?type=quick&ak=o9B4Ol99j9NcBXSu5nFTR7uI&v=1.0');

document.getElementsByTagName("head")[0].appendChild(scriptFile);

When you finally want to add it to the head, chrome comes up with the following warning.
Failed to execute ‘write’ on ‘Document’: It isn’t possible to write into a document from an asynchronously-loaded external script Unless it is explicitly opened.
What is this?
PS: An error in chrome in console (a red error mark) will prevent the script from executing after the error, a warning (yellow exclamation mark) just won’t execute where it was warned.

Solution.
This occurs because the code introduced contains a document.write method, and asynchronously loaded js is not allowed to use the document.write method.
Since the document has been loaded and parsed, the document stream is closed.
So the js you load asynchronously can no longer write into the document, such as using document.write.
So two direct links can be introduced.


var usel = '<script src="';
usel += gds[0].imageurl;
usel += '"></script>';
document.write(usel);

 

DOMException: play() failed because the user didn‘t interact with the document first

error is due to the new feature of chrome, which basically means that developers cannot use their permissions to cause noise interference to users, and users need to interact with audio/video

to load the page for the first time

The requirements are as follows:
refresh the alarm list in real time to ensure the user gets the latest alarm message. When there is a new alarm message, sound the alarm bell

solution

enable alarm bell to prompt users when they first enter the page

let audioPlay = document.getElementById('myaudio')

audioPlay.play()

setTimeout(() => {
  audioPlay.pause()
  audioPlay.load()
}, 10)

click to interact with audio for the first time, set 10 milliseconds and the user will not hear the bell. Set the alarm time to

when using again